Add status command
This commit is contained in:
parent
2b4c6d3318
commit
e26879425f
9 changed files with 589 additions and 10 deletions
|
|
@ -23,6 +23,7 @@ func ParseCliArguments(name, description string, arguments []string) (CliArgumen
|
|||
parser := argparse.NewParser(name, description)
|
||||
|
||||
syncCMD := parser.NewCommand("sync", "Synchronize repositories with remote branches, if the repository does not exist, clone it. (If pulling is not possible, the repository will be fetched)")
|
||||
statusCMD := parser.NewCommand("status", "Get information about repositories")
|
||||
|
||||
configFile := parser.String("c", "config-file", &argparse.Options{
|
||||
Default: getDefaultConfigDir(),
|
||||
|
|
@ -38,16 +39,19 @@ func ParseCliArguments(name, description string, arguments []string) (CliArgumen
|
|||
Default: false,
|
||||
Help: "Turn off color printing",
|
||||
})
|
||||
|
||||
if err := parser.Parse(arguments); err != nil {
|
||||
return CliArguments{}, err
|
||||
return CliArguments{}, errors.New(parser.Usage("Please follow this help"))
|
||||
}
|
||||
if !syncCMD.Happened() && !(*version) {
|
||||
|
||||
if !syncCMD.Happened() && !(*version) && !statusCMD.Happened() {
|
||||
return CliArguments{}, errors.New(errNoCommand)
|
||||
}
|
||||
|
||||
return CliArguments{
|
||||
ConfigurationFile: *configFile,
|
||||
Sync: syncCMD.Happened(),
|
||||
Status: statusCMD.Happened(),
|
||||
Version: *version,
|
||||
Color: !(*color),
|
||||
}, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue