1
0
mirror of https://github.com/directorz/mailfull-go.git synced 2025-12-23 12:37:09 +00:00

Add a option to subcommands #7

This commit is contained in:
teru
2016-08-28 17:09:09 +09:00
parent 50d429ad78
commit 3a1d4a588c
15 changed files with 210 additions and 16 deletions

View File

@@ -20,7 +20,7 @@ func (c *DomainDisableCommand) Synopsis() string {
func (c *DomainDisableCommand) Help() string {
txt := fmt.Sprintf(`
Usage:
%s %s domain
%s %s [-n] domain
Description:
%s
@@ -28,6 +28,10 @@ Description:
Required Args:
domain
The domain name that you want to disable.
Optional Args:
-n
Don't update databases.
`,
c.CmdName, c.SubCmdName,
c.Synopsis())
@@ -37,6 +41,12 @@ Required Args:
// Run runs the command and returns the exit status.
func (c *DomainDisableCommand) 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) != 1 {
fmt.Fprintf(c.UI.ErrorWriter, "%v\n", c.Help())
return 1
@@ -67,6 +77,10 @@ func (c *DomainDisableCommand) 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)