aboutsummaryrefslogtreecommitdiff
path: root/cmd/mygit
diff options
context:
space:
mode:
authorcodecrafters-bot <hello@codecrafters.io>2024-05-31 23:53:46 +0000
committercodecrafters-bot <hello@codecrafters.io>2024-05-31 23:53:46 +0000
commita44c04461463d7c8c3798fbd29ea16a5d56d4de7 (patch)
tree64cb0c5d23429d202fb3459566fd536228f57856 /cmd/mygit
downloadgit-go-a44c04461463d7c8c3798fbd29ea16a5d56d4de7.tar.gz
git-go-a44c04461463d7c8c3798fbd29ea16a5d56d4de7.zip
init [skip ci]
Diffstat (limited to 'cmd/mygit')
-rw-r--r--cmd/mygit/main.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/cmd/mygit/main.go b/cmd/mygit/main.go
new file mode 100644
index 0000000..a8d2b65
--- /dev/null
+++ b/cmd/mygit/main.go
@@ -0,0 +1,40 @@
+package main
+
+import (
+ "fmt"
+ // Uncomment this block to pass the first stage!
+ // "os"
+)
+
+// Usage: your_git.sh <command> <arg1> <arg2> ...
+func main() {
+ // You can use print statements as follows for debugging, they'll be visible when running tests.
+ fmt.Println("Logs from your program will appear here!")
+
+ // Uncomment this block to pass the first stage!
+ //
+ // if len(os.Args) < 2 {
+ // fmt.Fprintf(os.Stderr, "usage: mygit <command> [<args>...]\n")
+ // os.Exit(1)
+ // }
+ //
+ // switch command := os.Args[1]; command {
+ // case "init":
+ // for _, dir := range []string{".git", ".git/objects", ".git/refs"} {
+ // if err := os.MkdirAll(dir, 0755); err != nil {
+ // fmt.Fprintf(os.Stderr, "Error creating directory: %s\n", err)
+ // }
+ // }
+ //
+ // headFileContents := []byte("ref: refs/heads/main\n")
+ // if err := os.WriteFile(".git/HEAD", headFileContents, 0644); err != nil {
+ // fmt.Fprintf(os.Stderr, "Error writing file: %s\n", err)
+ // }
+ //
+ // fmt.Println("Initialized git directory")
+ //
+ // default:
+ // fmt.Fprintf(os.Stderr, "Unknown command %s\n", command)
+ // os.Exit(1)
+ // }
+}