codecrafters-bot пре 1 недеља
комит
ca1f4f39fa
9 измењених фајлова са 108 додато и 0 уклоњено
  1. 11
    0
      .codecrafters/compile.sh
  2. 11
    0
      .codecrafters/run.sh
  3. 1
    0
      .gitattributes
  4. 34
    0
      README.md
  5. 13
    0
      app/main.go
  6. 11
    0
      codecrafters.yml
  7. 3
    0
      go.mod
  8. 0
    0
      go.sum
  9. 24
    0
      your_program.sh

+ 11
- 0
.codecrafters/compile.sh Прегледај датотеку

@@ -0,0 +1,11 @@
1
+#!/bin/sh
2
+#
3
+# This script is used to compile your program on CodeCrafters
4
+#
5
+# This runs before .codecrafters/run.sh
6
+#
7
+# Learn more: https://codecrafters.io/program-interface
8
+
9
+set -e # Exit on failure
10
+
11
+go build -o /tmp/codecrafters-build-shell-go app/*.go

+ 11
- 0
.codecrafters/run.sh Прегледај датотеку

@@ -0,0 +1,11 @@
1
+#!/bin/sh
2
+#
3
+# This script is used to run your program on CodeCrafters
4
+#
5
+# This runs after .codecrafters/compile.sh
6
+#
7
+# Learn more: https://codecrafters.io/program-interface
8
+
9
+set -e # Exit on failure
10
+
11
+exec /tmp/codecrafters-build-shell-go "$@"

+ 1
- 0
.gitattributes Прегледај датотеку

@@ -0,0 +1 @@
1
+* text=auto

+ 34
- 0
README.md Прегледај датотеку

@@ -0,0 +1,34 @@
1
+[![progress-banner](https://backend.codecrafters.io/progress/shell/84641929-8f1d-473c-9a70-8bcf9bbab338)](https://app.codecrafters.io/users/codecrafters-bot?r=2qF)
2
+
3
+This is a starting point for Go solutions to the
4
+["Build Your Own Shell" Challenge](https://app.codecrafters.io/courses/shell/overview).
5
+
6
+In this challenge, you'll build your own POSIX compliant shell that's capable of
7
+interpreting shell commands, running external programs and builtin commands like
8
+cd, pwd, echo and more. Along the way, you'll learn about shell command parsing,
9
+REPLs, builtin commands, and more.
10
+
11
+**Note**: If you're viewing this repo on GitHub, head over to
12
+[codecrafters.io](https://codecrafters.io) to try the challenge.
13
+
14
+# Passing the first stage
15
+
16
+The entry point for your `shell` implementation is in `app/main.go`. Study and
17
+uncomment the relevant code, and push your changes to pass the first stage:
18
+
19
+```sh
20
+git commit -am "pass 1st stage" # any msg
21
+git push origin master
22
+```
23
+
24
+Time to move on to the next stage!
25
+
26
+# Stage 2 & beyond
27
+
28
+Note: This section is for stages 2 and beyond.
29
+
30
+1. Ensure you have `go (1.25)` installed locally
31
+1. Run `./your_program.sh` to run your program, which is implemented in
32
+   `app/main.go`.
33
+1. Commit your changes and run `git push origin master` to submit your solution
34
+   to CodeCrafters. Test output will be streamed to your terminal.

+ 13
- 0
app/main.go Прегледај датотеку

@@ -0,0 +1,13 @@
1
+package main
2
+
3
+import (
4
+	"fmt"
5
+)
6
+
7
+// Ensures gofmt doesn't remove the "fmt" import in stage 1 (feel free to remove this!)
8
+var _ = fmt.Print
9
+
10
+func main() {
11
+	// TODO: Uncomment the code below to pass the first stage
12
+	// fmt.Print("$ ")
13
+}

+ 11
- 0
codecrafters.yml Прегледај датотеку

@@ -0,0 +1,11 @@
1
+# Set this to true if you want debug logs.
2
+#
3
+# These can be VERY verbose, so we suggest turning them off
4
+# unless you really need them.
5
+debug: false
6
+
7
+# Use this to change the Go version used to run your code
8
+# on Codecrafters.
9
+#
10
+# Available versions: go-1.25
11
+buildpack: go-1.25

+ 3
- 0
go.mod Прегледај датотеку

@@ -0,0 +1,3 @@
1
+module github.com/codecrafters-io/shell-starter-go
2
+
3
+go 1.25.0


+ 24
- 0
your_program.sh Прегледај датотеку

@@ -0,0 +1,24 @@
1
+#!/bin/sh
2
+#
3
+# Use this script to run your program LOCALLY.
4
+#
5
+# Note: Changing this script WILL NOT affect how CodeCrafters runs your program.
6
+#
7
+# Learn more: https://codecrafters.io/program-interface
8
+
9
+set -e # Exit early if any commands fail
10
+
11
+# Copied from .codecrafters/compile.sh
12
+#
13
+# - Edit this to change how your program compiles locally
14
+# - Edit .codecrafters/compile.sh to change how your program compiles remotely
15
+(
16
+  cd "$(dirname "$0")" # Ensure compile steps are run within the repository directory
17
+  go build -o /tmp/codecrafters-build-shell-go app/*.go
18
+)
19
+
20
+# Copied from .codecrafters/run.sh
21
+#
22
+# - Edit this to change how your program runs locally
23
+# - Edit .codecrafters/run.sh to change how your program runs remotely
24
+exec /tmp/codecrafters-build-shell-go "$@"