working on lock command

This commit is contained in:
2020-06-08 22:52:40 -04:00
parent c2e74ce7f4
commit 441a9ed233
9 changed files with 132 additions and 48 deletions

View File

@@ -55,6 +55,9 @@ func main() {
// Adding the ignore commands
ignoreCommands(cli, &conf)
// Adding the lock commands
lockCommands(cli, &conf)
// Adding the test commands
infoCommands(cli, &conf)
@@ -98,7 +101,7 @@ func refreshCommand(cli *clir.Cli, conf *clientconfig.Gvcconfig) {
fmt.Println("no valid repo found.. please run 'init' to setup a repo first")
os.Exit(0)
}
err := clientcmd.RefreshContent(conf)
err := clientcmd.RefreshContent(conf, conf.RepoName)
if err != nil {
return fmt.Errorf("unable to refresh content: %s", err)
}
@@ -432,7 +435,7 @@ func remoteCommands(cli *clir.Cli, conf *config.Gvcconfig) {
})
}
func lockCommands(cli clir.Cli, conf *clientconfig.Gvcconfig) {
func lockCommands(cli *clir.Cli, conf *clientconfig.Gvcconfig) {
//All the lock commands and subcommands
//The lock subcommand
@@ -454,7 +457,11 @@ func lockCommands(cli clir.Cli, conf *clientconfig.Gvcconfig) {
fmt.Println("no valid repo found.. please run 'init' to setup a repo first")
os.Exit(0)
}
if len(lockCmd.OtherArgs()) > 0 {
if len(lockCmd.OtherArgs()) == 0 && file == "" && folder == "" && wildcard == "" { // if no input
lockCmd.PrintHelp()
return fmt.Errorf("please provide a file/folder/ext flag and name to be locked")
}
if len(lockCmd.OtherArgs()) > 1 {
lockCmd.PrintHelp()
return fmt.Errorf("incorrect input detected, please fix and retry")
}