https://github.com/toshimaru/torch
`torch` = `mkdir` + `touch`. Written in Rust.
https://github.com/toshimaru/torch
command rust
Last synced: 3 months ago
JSON representation
`torch` = `mkdir` + `touch`. Written in Rust.
- Host: GitHub
- URL: https://github.com/toshimaru/torch
- Owner: toshimaru
- License: mit
- Created: 2023-07-09T08:46:54.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-01T22:06:12.000Z (about 2 years ago)
- Last Synced: 2025-09-22T15:30:14.572Z (9 months ago)
- Topics: command, rust
- Language: Rust
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/toshimaru/torch/actions/workflows/test.yml)
[](https://crates.io/crates/torch-cmd)
# 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:
```console
$ mkdir -p path/to
$ touch path/to/file.txt
```
`torch` reduces that to one:
```console
$ 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
```console
$ torch ...
```
Examples:
```console
$ torch notes/today.md
$ torch app/models/user.rb app/controllers/users_controller.rb
$ torch tmp/output.log
```
This command:
```console
$ torch docs/guides/getting-started.md
```
is roughly equivalent to:
```console
$ mkdir -p docs/guides
$ touch docs/guides/getting-started.md
```
To see the built-in CLI help:
```console
$ torch --help
```
## Install
### Cargo
```console
$ cargo install torch-cmd
```
### Homebrew
```console
$ brew install toshimaru/homebrew-torch/torch-cmd
```
## Development
Run the test suite:
```console
$ cargo test
```
Run the CLI locally:
```console
$ cargo run -- path/to/file.txt
```
## License
MIT