github.com/henvic/wedeploycli@v1.7.6-0.20200319005353-3630f582f284/command/canceled/canceled.go (about) 1 package canceled 2 3 // Command skipped / canceled by the user 4 type Command struct { 5 msg string 6 7 quiet bool 8 } 9 10 func (cc Command) Error() string { 11 return cc.msg 12 } 13 14 // Quiet tells whether the error message should be print on termination 15 func (cc Command) Quiet() bool { 16 return cc.quiet 17 } 18 19 // CancelCommand creates a 'cancelled command' error 20 // so the system can end the program with exit code 0 21 // when a user cancels a command on the CLI prompt 22 func CancelCommand(s string) error { 23 return Command{ 24 msg: s, 25 } 26 } 27 28 // Skip creates a 'quietly cancelled command' 29 func Skip() error { 30 return Command{ 31 quiet: true, 32 } 33 }