Skip to content

Commit

Permalink
add arg
Browse files Browse the repository at this point in the history
  • Loading branch information
clementblaise committed May 21, 2021
1 parent cc69fa5 commit 2f2793a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func init() {
execCmd.Flags().StringP("module", "m", utils.EmptyString, "module name to execute (default=command)")
execCmd.Flags().StringP("pattern", "p", utils.EmptyString, "host pattern")
execCmd.Flags().StringP("args", "a", utils.EmptyString, "module arguments")
_ = execCmd.MarkFlagRequired("args")
execCmd.Flags().StringSliceP("extra-vars", "e", []string{}, "set additional variables as key=value or YAML/JSON, if filename prepend with @")

execCmd.Flags().IntP("background", "B", 0, "run asynchronously, failing after X seconds")
Expand Down
3 changes: 2 additions & 1 deletion internal/ansible/command.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ansible

import (
"errors"
"fmt"
log "github.com/sirupsen/logrus"
"os"
Expand Down Expand Up @@ -95,7 +96,7 @@ func (o *AdHocCmd) AddExtraVar(name string, value interface{}) error {
}
_, exists := o.ExtraVars[name]
if exists {
return errors.New("(adhoc::AddExtraVar)", fmt.Sprintf("ExtraVar '%s' already exist", name))
return errors.New(fmt.Sprintf("ExtraVar '%s' already exist", name))
}

o.ExtraVars[name] = value
Expand Down

0 comments on commit 2f2793a

Please sign in to comment.