Improve command not found error message
This commit is contained in:
parent
8bc5810d9a
commit
3745c27fe8
|
@ -1,7 +1,8 @@
|
||||||
# Next
|
# Next
|
||||||
|
- Improve command not found error message
|
||||||
- Add goimports beautifier for Go language
|
- Add goimports beautifier for Go language
|
||||||
- ...
|
|
||||||
- Fixes [#1728](https://github.com/Glavin001/atom-beautify/issues/1728). Remove Shell-Env from Executable, use Atom's process.env instead. See [#1735](https://github.com/Glavin001/atom-beautify/pull/1735).
|
- Fixes [#1728](https://github.com/Glavin001/atom-beautify/issues/1728). Remove Shell-Env from Executable, use Atom's process.env instead. See [#1735](https://github.com/Glavin001/atom-beautify/pull/1735).
|
||||||
|
- ...
|
||||||
|
|
||||||
# v0.30.2 (2017-06-20)
|
# v0.30.2 (2017-06-20)
|
||||||
- Fixes [#1030](https://github.com/Glavin001/atom-beautify/issues/1030). Add support for alpha versions of autopep8
|
- Fixes [#1030](https://github.com/Glavin001/atom-beautify/issues/1030). Add support for alpha versions of autopep8
|
||||||
|
|
|
@ -78,8 +78,11 @@ describe "Atom-Beautify", ->
|
||||||
expect(v).not.toBe(null)
|
expect(v).not.toBe(null)
|
||||||
expect(v instanceof Error).toBe(true)
|
expect(v instanceof Error).toBe(true)
|
||||||
expect(v.code).toBe("CommandNotFound")
|
expect(v.code).toBe("CommandNotFound")
|
||||||
expect(v.description).toBe(undefined, \
|
expect(typeof v.description).toBe("string", \
|
||||||
'Error should not have a description.')
|
'Error should have a description.')
|
||||||
|
expect(v.description
|
||||||
|
.indexOf("Executable - Beautifier - Path")).toBe(-1, \
|
||||||
|
"Error should not have pathOption.")
|
||||||
return v
|
return v
|
||||||
p.then(cb, cb)
|
p.then(cb, cb)
|
||||||
return p
|
return p
|
||||||
|
|
|
@ -187,6 +187,11 @@ module.exports = class Beautifier
|
||||||
installation: @link
|
installation: @link
|
||||||
cmd: executable
|
cmd: executable
|
||||||
})
|
})
|
||||||
|
help ?= {
|
||||||
|
program: executable
|
||||||
|
link: @link
|
||||||
|
pathOption: undefined
|
||||||
|
}
|
||||||
exe.run(args, {cwd, ignoreReturnCode, help, onStdin})
|
exe.run(args, {cwd, ignoreReturnCode, help, onStdin})
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
|
@ -134,6 +134,11 @@ class Executable
|
||||||
{ cmd, cwd, ignoreReturnCode, help, onStdin, returnStderr, returnStdoutOrStderr } = options
|
{ cmd, cwd, ignoreReturnCode, help, onStdin, returnStderr, returnStdoutOrStderr } = options
|
||||||
exeName = cmd or @cmd
|
exeName = cmd or @cmd
|
||||||
cwd ?= os.tmpDir()
|
cwd ?= os.tmpDir()
|
||||||
|
help ?= {
|
||||||
|
program: @cmd
|
||||||
|
link: @installation or @homepage
|
||||||
|
pathOption: "Executable - #{@name or @cmd} - Path"
|
||||||
|
}
|
||||||
|
|
||||||
# Resolve executable and all args
|
# Resolve executable and all args
|
||||||
Promise.all([@shellEnv(), this.resolveArgs(args)])
|
Promise.all([@shellEnv(), this.resolveArgs(args)])
|
||||||
|
@ -276,45 +281,22 @@ class Executable
|
||||||
if help?
|
if help?
|
||||||
if typeof help is "object"
|
if typeof help is "object"
|
||||||
# Basic notice
|
# Basic notice
|
||||||
helpStr = "See #{help.link} for program \
|
docsLink = "https://github.com/Glavin001/atom-beautify#beautifiers"
|
||||||
installation instructions.\n"
|
helpStr = "See #{exe} installation instructions at #{docsLink}#{if help.link then (' or go to '+help.link) else ''}\n"
|
||||||
# Help to configure Atom Beautify for program's path
|
# # Help to configure Atom Beautify for program's path
|
||||||
helpStr += "You can configure Atom Beautify \
|
helpStr += "You can configure Atom Beautify \
|
||||||
with the absolute path \
|
with the absolute path \
|
||||||
to '#{help.program or exe}' by setting \
|
to '#{help.program or exe}' by setting \
|
||||||
'#{help.pathOption}' in \
|
'#{help.pathOption}' in \
|
||||||
the Atom Beautify package settings.\n" if help.pathOption
|
the Atom Beautify package settings.\n" if help.pathOption
|
||||||
# Optional, additional help
|
|
||||||
helpStr += help.additional if help.additional
|
|
||||||
# Common Help
|
|
||||||
issueSearchLink =
|
|
||||||
"https://github.com/Glavin001/atom-beautify/\
|
|
||||||
search?q=#{exe}&type=Issues"
|
|
||||||
docsLink = "https://github.com/Glavin001/\
|
|
||||||
atom-beautify/tree/master/docs"
|
|
||||||
helpStr += "Your program is properly installed if running \
|
helpStr += "Your program is properly installed if running \
|
||||||
'#{if @isWindows() then 'where.exe' \
|
'#{if @isWindows() then 'where.exe' \
|
||||||
else 'which'} #{exe}' \
|
else 'which'} #{exe}' \
|
||||||
in your #{if @isWindows() then 'CMD prompt' \
|
in your #{if @isWindows() then 'CMD prompt' \
|
||||||
else 'Terminal'} \
|
else 'Terminal'} \
|
||||||
returns an absolute path to the executable. \
|
returns an absolute path to the executable.\n"
|
||||||
If this does not work then you have not \
|
# # Optional, additional help
|
||||||
installed the program correctly and so \
|
helpStr += help.additional if help.additional
|
||||||
Atom Beautify will not find the program. \
|
|
||||||
Atom Beautify requires that the program be \
|
|
||||||
found in your PATH environment variable. \n\
|
|
||||||
Note that this is not an Atom Beautify issue \
|
|
||||||
if beautification does not work and the above \
|
|
||||||
command also does not work: this is expected \
|
|
||||||
behaviour, since you have not properly installed \
|
|
||||||
your program. Please properly setup the program \
|
|
||||||
and search through existing Atom Beautify issues \
|
|
||||||
before creating a new issue. \
|
|
||||||
See #{issueSearchLink} for related Issues and \
|
|
||||||
#{docsLink} for documentation. \
|
|
||||||
If you are still unable to resolve this issue on \
|
|
||||||
your own then please create a new issue and \
|
|
||||||
ask for help.\n"
|
|
||||||
er.description = helpStr
|
er.description = helpStr
|
||||||
else #if typeof help is "string"
|
else #if typeof help is "string"
|
||||||
er.description = help
|
er.description = help
|
||||||
|
|
Loading…
Reference in New Issue