3 unstable releases
| 0.2.0 | Mar 15, 2026 |
|---|---|
| 0.1.1 | Jan 27, 2024 |
| 0.1.0 | Jan 14, 2024 |
#832 in Command line utilities
12KB
193 lines
torch
torch is a small CLI that combines mkdir -p and touch.
It creates parent directories when needed, then creates the file.
Why
Creating a file in a nested path usually takes two commands:
$ mkdir -p path/to
$ touch path/to/file.txt
torch reduces that to one:
$ torch path/to/file.txt
What it does
Given one or more paths, torch:
- creates missing parent directories
- creates the target file if it does not exist
- updates the access and modification times if it already exists
- exits with a non-zero status if any path fails
Usage
$ torch <PATH>...
Examples:
$ torch notes/today.md
$ torch app/models/user.rb app/controllers/users_controller.rb
$ torch tmp/output.log
This command:
$ torch docs/guides/getting-started.md
is roughly equivalent to:
$ mkdir -p docs/guides
$ touch docs/guides/getting-started.md
To see the built-in CLI help:
$ torch --help
Install
Cargo
$ cargo install torch-cmd
Homebrew
$ brew install toshimaru/homebrew-torch/torch-cmd
Development
Run the test suite:
$ cargo test
Run the CLI locally:
$ cargo run -- path/to/file.txt
License
MIT
Dependencies
~1–1.6MB
~29K SLoC