"true" and "false" commands are implemented.

This commit is contained in:
jienfak 2019-11-08 04:00:23 +05:00
parent 023cea5bbe
commit f1fd751b48
3 changed files with 15 additions and 1 deletions

5
gfalse/false.go Normal file
View file

@ -0,0 +1,5 @@
package gfalse
func Run(args []string) int {
return 1
}

5
gtrue/true.go Normal file
View file

@ -0,0 +1,5 @@
package gtrue
func Run(args []string) int {
return 0
}

View file

@ -7,6 +7,8 @@ import(
"github.com/jienfak/goblin/cat" "github.com/jienfak/goblin/cat"
"github.com/jienfak/goblin/echo" "github.com/jienfak/goblin/echo"
"github.com/jienfak/goblin/mkdir" "github.com/jienfak/goblin/mkdir"
"github.com/jienfak/goblin/gtrue"
"github.com/jienfak/goblin/gfalse"
) )
func main() { func main() {
@ -20,6 +22,8 @@ func main() {
"cat": cat.Run, "cat": cat.Run,
"mkdir" : mkdir.Run, "mkdir" : mkdir.Run,
"echo" : echo.Run, "echo" : echo.Run,
"true" : gtrue.Run,
"false" : gfalse.Run,
} }
if binBase := path.Base(os.Args[0]) ; binBase != "goblin" { if binBase := path.Base(os.Args[0]) ; binBase != "goblin" {
@ -42,4 +46,4 @@ func main() {
} }
status := utilsMap[utilName].(func([]string) int )(args) status := utilsMap[utilName].(func([]string) int )(args)
os.Exit(status) os.Exit(status)
} }