feat: read file paths from stdin and print plain paths from piped ls
This commit is contained in:
parent
9743103faf
commit
98044782e5
4 changed files with 119 additions and 20 deletions
12
README.md
12
README.md
|
|
@ -110,6 +110,18 @@ $ otag write --clear id3 song.mp3
|
|||
| `frontmatter` | `.md` `.markdown` `.txt` | `projects`, `contexts`, `tags` and `note` keys of the YAML front matter; other keys, comments and formatting are left untouched |
|
||||
| `comment` | Source code such as `.py` `.sh` `.toml` `.js` `.c` `.go` `.rs` `.php` `.html` | An `otag: +project @context #tag note` comment line within the first ten lines, written in the file's comment style below any shebang, encoding, `<!DOCTYPE>` or `<?php` line |
|
||||
|
||||
### Piping
|
||||
|
||||
`add`, `remove`, `del` and `write` read the paths from stdin, one per line, when the file is given as `-`. A file actually named `-` is written as `./-`. The command runs for every path; a failing path prints its error without stopping the others, and otag exits with 1 at the end. When the output of `list` goes into a pipe or file instead of the terminal, it prints the bare paths, one per line, so otag can feed itself and other tools.
|
||||
|
||||
```
|
||||
$ ls *.mp3 | otag add - +album '#lofi'
|
||||
$ find . -name '*.pdf' | otag write pdf -
|
||||
$ otag ls '#draft' | otag remove - '#draft'
|
||||
```
|
||||
|
||||
`ls folder` prints the names without the `folder/` prefix, so use `ls folder/*` or `find folder` for files outside the current folder.
|
||||
|
||||
### Import and Export
|
||||
|
||||
`export` (`e`) writes all entries of the file's directory tree to a text file (default: `context.txt`), one `path --- tags` line per file. `import` (`i`) reads such a file back and adds the tags that are missing.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue