Skip to content

Commit 162d2f8

Browse files
committed
refactor: realms & cli
1 parent f6dafca commit 162d2f8

File tree

11 files changed

+90
-3
lines changed

11 files changed

+90
-3
lines changed

.github/workflows/gno-fmt.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ jobs:
3333
cache: true
3434

3535
- name: Ensure deps are downloaded
36+
working-directory: realms
3637
run: go mod download
3738

3839
- name: Format
39-
working-directory: realms
40+
working-directory: realms/src
4041
run: go run github.com/gnolang/gno/gnovm/cmd/gno fmt -diff ./...

.github/workflows/gno-lint.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ jobs:
3232
cache: true
3333

3434
- name: Ensure deps are downloaded
35+
working-directory: realms
3536
run: go mod download
3637

3738
- name: Lint
38-
working-directory: realms
39+
working-directory: realms/src
3940
run: go run github.com/gnolang/gno/gnovm/cmd/gno lint ./... -v

.github/workflows/gno-test.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ jobs:
3232
cache: true
3333

3434
- name: Ensure deps are downloaded
35+
working-directory: realms
3536
run: go mod download
3637

3738
- name: Test
38-
working-directory: realms
39+
working-directory: realms/src
3940
run: go run github.com/gnolang/gno/gnovm/cmd/gno test ./... -v

cli/src/main.go

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
// "strings"
7+
8+
// "gnit/cli/internal/commands"
9+
// "gnit/cli/internal/config"
10+
// "gnit/cli/internal/gnokey"
11+
)
12+
13+
func main() {
14+
if len(os.Args) < 2 {
15+
printUsage()
16+
os.Exit(1)
17+
}
18+
19+
// cfg := config.DefaultConfig()
20+
21+
// client := gnokey.NewClient(cfg)
22+
23+
command := os.Args[1]
24+
25+
switch command {
26+
case "pull":
27+
// handlePull(client, cfg)
28+
case "commit":
29+
// handleCommit(client, cfg)
30+
case "help", "--help", "-h":
31+
printUsage()
32+
default:
33+
fmt.Printf("Error: unknown command '%s'\n", command)
34+
printUsage()
35+
os.Exit(1)
36+
}
37+
}
38+
39+
// func handlePull(client *gnokey.Client, cfg *config.Config) {
40+
// if len(os.Args) < 3 {
41+
// fmt.Println("Error: filename required for pull")
42+
// fmt.Println("Usage: gnit pull <file>")
43+
// os.Exit(1)
44+
// }
45+
46+
// filename := os.Args[2]
47+
// cmd := commands.NewPull(client, cfg)
48+
49+
// if err := cmd.Execute(filename); err != nil {
50+
// fmt.Printf("Error: %v\n", err)
51+
// os.Exit(1)
52+
// }
53+
// }
54+
55+
// func handleCommit(client *gnokey.Client, cfg *config.Config) {
56+
// if len(os.Args) < 3 {
57+
// fmt.Println("Error: message required for commit")
58+
// fmt.Println("Usage: gnit commit \"<message>\"")
59+
// os.Exit(1)
60+
// }
61+
62+
// message := strings.Join(os.Args[2:], " ")
63+
// message = strings.Trim(message, "\"")
64+
65+
// cmd := commands.NewCommit(client, cfg)
66+
67+
// if err := cmd.Execute(message); err != nil {
68+
// fmt.Printf("Error: %v\n", err)
69+
// os.Exit(1)
70+
// }
71+
// }
72+
73+
func printUsage() {
74+
fmt.Println("Usage: gnit <command> [options]")
75+
fmt.Println()
76+
fmt.Println("Available commands:")
77+
fmt.Println(" pull <file> Fetch a file from the repository")
78+
fmt.Println(" commit <message> Commit changes with a message")
79+
fmt.Println(" help Display this help")
80+
fmt.Println()
81+
fmt.Println("Examples:")
82+
fmt.Println(" gnit pull example.gno")
83+
fmt.Println(" gnit commit \"My commit message\"")
84+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)