mirror of
https://github.com/directorz/mailfull-go.git
synced 2025-12-20 02:57:06 +00:00
Add a option to subcommands #7
This commit is contained in:
@@ -21,7 +21,7 @@ func (c *AliasUserModCommand) Synopsis() string {
|
||||
func (c *AliasUserModCommand) Help() string {
|
||||
txt := fmt.Sprintf(`
|
||||
Usage:
|
||||
%s %s address target [target...]
|
||||
%s %s [-n] address target [target...]
|
||||
|
||||
Description:
|
||||
%s
|
||||
@@ -31,6 +31,10 @@ Required Args:
|
||||
The email address that you want to modify.
|
||||
target
|
||||
Target email addresses.
|
||||
|
||||
Optional Args:
|
||||
-n
|
||||
Don't update databases.
|
||||
`,
|
||||
c.CmdName, c.SubCmdName,
|
||||
c.Synopsis())
|
||||
@@ -40,6 +44,12 @@ Required Args:
|
||||
|
||||
// Run runs the command and returns the exit status.
|
||||
func (c *AliasUserModCommand) Run(args []string) int {
|
||||
noCommit, err := noCommitFlag(&args)
|
||||
if err != nil {
|
||||
fmt.Fprintf(c.UI.ErrorWriter, "%v\n", c.Help())
|
||||
return 1
|
||||
}
|
||||
|
||||
if len(args) < 2 {
|
||||
fmt.Fprintf(c.UI.ErrorWriter, "%v\n", c.Help())
|
||||
return 1
|
||||
@@ -82,6 +92,10 @@ func (c *AliasUserModCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
if noCommit {
|
||||
return 0
|
||||
}
|
||||
|
||||
mailData, err := repo.MailData()
|
||||
if err != nil {
|
||||
fmt.Fprintf(c.UI.ErrorWriter, "[ERR] %v\n", err)
|
||||
|
||||
Reference in New Issue
Block a user