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:
@@ -20,7 +20,7 @@ func (c *DomainEnableCommand) Synopsis() string {
|
||||
func (c *DomainEnableCommand) 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 enable.
|
||||
|
||||
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 *DomainEnableCommand) 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 *DomainEnableCommand) 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