-
Notifications
You must be signed in to change notification settings - Fork 12
/
main.go
50 lines (43 loc) · 977 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"io"
"log"
"os"
"github.com/urfave/cli/v2"
"github.com/yakuter/gol/commands/cat"
"github.com/yakuter/gol/commands/cp"
"github.com/yakuter/gol/commands/echo"
"github.com/yakuter/gol/commands/grep"
"github.com/yakuter/gol/commands/help"
"github.com/yakuter/gol/commands/ls"
"github.com/yakuter/gol/commands/mkdir"
"github.com/yakuter/gol/commands/pwd"
"github.com/yakuter/gol/commands/touch"
"github.com/yakuter/gol/commands/whoami"
)
var Version = "v1.0.0"
func main() {
app := &cli.App{
Name: "Gol",
Usage: "Go implementation of Linux commands",
Commands: Commands(os.Stdin),
Version: Version,
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}
func Commands(reader io.Reader) []*cli.Command {
return []*cli.Command{
help.Command(),
echo.Command(),
pwd.Command(),
mkdir.Command(),
touch.Command(),
whoami.Command(),
grep.Command(),
ls.Command(),
cat.Command(),
cp.Command(),
}
}