generated from bing/readnotes
32 lines
359 B
Go
32 lines
359 B
Go
|
package test
|
||
|
|
||
|
type Cmd interface{
|
||
|
Result()bool
|
||
|
Output()string
|
||
|
}
|
||
|
|
||
|
type cmd struct{
|
||
|
r bool
|
||
|
o string
|
||
|
}
|
||
|
|
||
|
func (c *cmd)exec(s string, args ...string){
|
||
|
//....
|
||
|
// c.r = ...
|
||
|
//c.o = ...
|
||
|
}
|
||
|
|
||
|
func (c *cmd)Result()bool{
|
||
|
return c.r
|
||
|
}
|
||
|
|
||
|
func (c *cmd)Output()string{
|
||
|
return c.o
|
||
|
}
|
||
|
|
||
|
func Exec(s string, args ...string)Cmd{
|
||
|
c := &cmd{}
|
||
|
c.exec(s, args...)
|
||
|
return c
|
||
|
}
|