mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-06-28 15:41:13 +08:00
set exit status
Some checks are pending
go: build dev binaries / cleanup (push) Waiting to run
go: build dev binaries / build_dev_linux_windows (amd64, linux) (push) Blocked by required conditions
go: build dev binaries / build_dev_linux_windows (amd64, windows) (push) Blocked by required conditions
go: build dev binaries / build_dev_darwin (amd64, darwin) (push) Blocked by required conditions
go: build dev binaries / build_dev_darwin (arm64, darwin) (push) Blocked by required conditions
docker: build dev containers / build-dev-containers (push) Waiting to run
End to End / FUSE Mount (push) Waiting to run
go: build binary / Build (push) Waiting to run
Ceph S3 tests / Ceph S3 tests (push) Waiting to run
Some checks are pending
go: build dev binaries / cleanup (push) Waiting to run
go: build dev binaries / build_dev_linux_windows (amd64, linux) (push) Blocked by required conditions
go: build dev binaries / build_dev_linux_windows (amd64, windows) (push) Blocked by required conditions
go: build dev binaries / build_dev_darwin (amd64, darwin) (push) Blocked by required conditions
go: build dev binaries / build_dev_darwin (arm64, darwin) (push) Blocked by required conditions
docker: build dev containers / build-dev-containers (push) Waiting to run
End to End / FUSE Mount (push) Waiting to run
go: build binary / Build (push) Waiting to run
Ceph S3 tests / Ceph S3 tests (push) Waiting to run
This commit is contained in:
parent
75ef324533
commit
7244a3d047
19
weed/weed.go
19
weed/weed.go
@ -98,12 +98,15 @@ func main() {
|
|||||||
cmd.Flag.Usage()
|
cmd.Flag.Usage()
|
||||||
fmt.Fprintf(os.Stderr, "Default Parameters:\n")
|
fmt.Fprintf(os.Stderr, "Default Parameters:\n")
|
||||||
cmd.Flag.PrintDefaults()
|
cmd.Flag.PrintDefaults()
|
||||||
|
// Command execution failed - general error
|
||||||
|
setExitStatus(1)
|
||||||
}
|
}
|
||||||
exit()
|
exit()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unknown command - syntax error
|
||||||
fmt.Fprintf(os.Stderr, "weed: unknown subcommand %q\nRun 'weed help' for usage.\n", args[0])
|
fmt.Fprintf(os.Stderr, "weed: unknown subcommand %q\nRun 'weed help' for usage.\n", args[0])
|
||||||
setExitStatus(2)
|
setExitStatus(2)
|
||||||
exit()
|
exit()
|
||||||
@ -155,19 +158,23 @@ func usage() {
|
|||||||
printUsage(os.Stderr)
|
printUsage(os.Stderr)
|
||||||
fmt.Fprintf(os.Stderr, "For Logging, use \"weed [logging_options] [command]\". The logging options are:\n")
|
fmt.Fprintf(os.Stderr, "For Logging, use \"weed [logging_options] [command]\". The logging options are:\n")
|
||||||
flag.PrintDefaults()
|
flag.PrintDefaults()
|
||||||
os.Exit(2)
|
// Invalid command line usage - syntax error
|
||||||
|
setExitStatus(2)
|
||||||
|
exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// help implements the 'help' command.
|
// help implements the 'help' command.
|
||||||
func help(args []string) {
|
func help(args []string) {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
printUsage(os.Stdout)
|
printUsage(os.Stdout)
|
||||||
// not exit 2: succeeded at 'weed help'.
|
// Success - help displayed correctly
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(args) != 1 {
|
if len(args) != 1 {
|
||||||
fmt.Fprintf(os.Stderr, "usage: weed help command\n\nToo many arguments given.\n")
|
fmt.Fprintf(os.Stderr, "usage: weed help command\n\nToo many arguments given.\n")
|
||||||
os.Exit(2) // failed at 'weed help'
|
// Invalid help usage - syntax error
|
||||||
|
setExitStatus(2)
|
||||||
|
exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
arg := args[0]
|
arg := args[0]
|
||||||
@ -175,13 +182,15 @@ func help(args []string) {
|
|||||||
for _, cmd := range commands {
|
for _, cmd := range commands {
|
||||||
if cmd.Name() == arg {
|
if cmd.Name() == arg {
|
||||||
tmpl(os.Stdout, helpTemplate, cmd)
|
tmpl(os.Stdout, helpTemplate, cmd)
|
||||||
// not exit 2: succeeded at 'weed help cmd'.
|
// Success - help for specific command displayed correctly
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(os.Stderr, "Unknown help topic %#q. Run 'weed help'.\n", arg)
|
fmt.Fprintf(os.Stderr, "Unknown help topic %#q. Run 'weed help'.\n", arg)
|
||||||
os.Exit(2) // failed at 'weed help cmd'
|
// Unknown help topic - syntax error
|
||||||
|
setExitStatus(2)
|
||||||
|
exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
var atexitFuncs []func()
|
var atexitFuncs []func()
|
||||||
|
Loading…
Reference in New Issue
Block a user