diff options
Diffstat (limited to 'tools/run')
-rw-r--r-- | tools/run/.envrc | 2 | ||||
-rw-r--r-- | tools/run/README.md | 30 | ||||
-rw-r--r-- | tools/run/default.nix | 11 | ||||
-rw-r--r-- | tools/run/main.go | 49 | ||||
-rw-r--r-- | tools/run/shell.nix | 10 |
5 files changed, 0 insertions, 102 deletions
diff --git a/tools/run/.envrc b/tools/run/.envrc deleted file mode 100644 index a4a62da526d3..000000000000 --- a/tools/run/.envrc +++ /dev/null @@ -1,2 +0,0 @@ -source_up -use_nix diff --git a/tools/run/README.md b/tools/run/README.md deleted file mode 100644 index d3cccecf910c..000000000000 --- a/tools/run/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# run - -Simplify the commands you call to run scripts on the command line. - -```shell -> run path/to/file.py -> run path/to/file.ts -``` - -## How? - -Define a run.json configuration mapping commands to filename extensions like -so: -```json -{ - ".ts": "npx ts-node $file", - ".py": "python3 $file" -} -``` - -Then call `run path/to/some/file.ts` on the command line, and `npx ts-node -file.ts` will run. - -## Installation - -Install `run` using Nix. - -```shell -> nix-env -iA briefcase.run -``` diff --git a/tools/run/default.nix b/tools/run/default.nix deleted file mode 100644 index 7d772c3f9079..000000000000 --- a/tools/run/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, depot, briefcase, ... }: - -depot.buildGo.program { - name = "run"; - srcs = [ - ./main.go - ]; - deps = with briefcase.gopkgs; [ - utils - ]; -} diff --git a/tools/run/main.go b/tools/run/main.go deleted file mode 100644 index 04906ece91f7..000000000000 --- a/tools/run/main.go +++ /dev/null @@ -1,49 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "log" - "os" - "os/exec" - "path/filepath" - "strings" - "utils" -) - -func main() { - if len(os.Args) != 2 { - log.Fatal("You can only call run with a single file at a time.") - } - - rulesPath := utils.Resolve("run.json", []string{"/home/wpcarro/.config/run/run.json"}) - b, err := ioutil.ReadFile(rulesPath) - if err != nil { - log.Fatal("Could not locate a run.json file: ", err) - } - rules := map[string]string{} - err = json.Unmarshal(b, &rules) - if err != nil { - log.Fatal("Could not decode run.json as JSON: ", err) - } - - fileName := os.Args[1] - ext := filepath.Ext(fileName) - cmd, ok := rules[ext] - - if !ok { - log.Fatalf("No rules for extension, %s, have been defined.", ext) - } - - // TODO(wpcarro): Support more sophisticated parsing than just string - // splitting. To handle 'cases like this'. - tokens := strings.Split(strings.Replace(cmd, "$file", fileName, 1), " ") - c := exec.Command(tokens[0], tokens[1:]...) - err = c.Start() - // TODO(wpcarro): Forward STDERR and STDOUT. - if err != nil { - log.Fatal(err) - } - fmt.Println(c.Wait()) -} diff --git a/tools/run/shell.nix b/tools/run/shell.nix deleted file mode 100644 index e14bffae487c..000000000000 --- a/tools/run/shell.nix +++ /dev/null @@ -1,10 +0,0 @@ -let - briefcase = import <briefcase> {}; - pkgs = briefcase.third_party.pkgs; -in pkgs.mkShell { - buildInputs = with pkgs; [ - go - goimports - godef - ]; -} |