3afb56a5e5
I'd like to be able to just call `run file.py` and have a program DWIM. I'm working on run as a step in this direction. Define a simple configuration that maps file extensions to template strings where "$file" is replaced with the argv[1]. It basically works but there are outstanding TODOs. See the README and source code for more information.
30 lines
474 B
Markdown
30 lines
474 B
Markdown
# 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
|
|
```
|