check for unsupported flags while running uplink (#316)
* uplink handle invalid or more than needed arguments * updated the error reporting * rebase from master * check for unsupported flags
This commit is contained in:
parent
f168e19fb4
commit
75110cf2da
@ -54,10 +54,16 @@ func init() {
|
||||
}
|
||||
|
||||
func cmdRun(cmd *cobra.Command, args []string) (err error) {
|
||||
if len(args) > 0x00 {
|
||||
fmt.Println("Invalid arguments. Rerun with 'uplink run'")
|
||||
return nil
|
||||
/* check for the supported flags */
|
||||
flagsupported := cmd.Flags()
|
||||
for _, flagname := range args {
|
||||
f := flagsupported.Lookup(flagname)
|
||||
if f == nil {
|
||||
fmt.Println(flagname + " - Invalid flag. try 'uplink run'")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return runCfg.Run(process.Ctx(cmd))
|
||||
}
|
||||
|
||||
@ -67,6 +73,16 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
/* check for the supported flags */
|
||||
flagsupported := cmd.Flags()
|
||||
for _, flagname := range args {
|
||||
f := flagsupported.Lookup(flagname)
|
||||
if f == nil {
|
||||
fmt.Println(flagname + " - Invalid flag. Supported list use --help")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
_, err = os.Stat(setupCfg.BasePath)
|
||||
if !setupCfg.Overwrite && err == nil {
|
||||
fmt.Println("An uplink configuration already exists. Rerun with --overwrite")
|
||||
|
Loading…
Reference in New Issue
Block a user