Skip to content

Commit 0482272

Browse files
committed
Initial Commit
0 parents  commit 0482272

File tree

6 files changed

+65
-0
lines changed

6 files changed

+65
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/
2+
dist/flight.exe

misc/flight.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
___ __ _ __ _
2+
.' ..][ | (_) [ | / |_
3+
_| |_ | | __ .--./)| |--. `| |-'
4+
'-| |-' | | [ | / /'`\;| .-. | | |
5+
| | | | | | \ \._//| | | | | |,
6+
[___] [___][___].',__`[___]|__]\__/
7+
( ( __))

src/func/func.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package flightpkg
2+
3+
import (
4+
"bufio"
5+
"fmt"
6+
"os"
7+
)
8+
9+
func Figlet() {
10+
// Open the file.
11+
f, _ := os.Open("..\\misc\\flight.txt")
12+
// Create a new Scanner for the file.
13+
scanner := bufio.NewScanner(f)
14+
// Loop over all lines in the file and print them.
15+
for scanner.Scan() {
16+
line := scanner.Text()
17+
fmt.Println(line)
18+
}
19+
fmt.Println()
20+
}
21+
22+
func Help() {
23+
fmt.Println(`flight <command> [arguments]
24+
25+
flight help
26+
flight version
27+
flight install <pkg>
28+
flight uninstall <pkg>
29+
flight update`)
30+
}

src/go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module flightpkg
2+
3+
go 1.18
4+
5+
require github.com/mbndr/figlet4go v0.0.0-20190224160619-d6cef5b186ea // indirect

src/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/mbndr/figlet4go v0.0.0-20190224160619-d6cef5b186ea h1:mQncVDBpKkAecPcH2IMGpKUQYhwowlafQbfkz2QFqkc=
2+
github.com/mbndr/figlet4go v0.0.0-20190224160619-d6cef5b186ea/go.mod h1:QzTGLGoOqLHUBK8/EZ0v4Fa4CdyXmdyRwCHcl0YbeO4=

src/main.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package main
2+
3+
import (
4+
funcs "flightpkg/func"
5+
"fmt"
6+
"os"
7+
)
8+
9+
func main() {
10+
cli := os.Args[1:]
11+
funcs.Figlet()
12+
if len(cli) == 0 {
13+
fmt.Println("flight <command> [arguments]")
14+
} else {
15+
if cli[0] == "help" {
16+
funcs.Help()
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)