refactor: rebuild the CLI with argparse subcommands and one handler per command

This commit is contained in:
randogoth 2026-10-24 21:59:26 +03:00
parent d879c6f871
commit e4fc6c0a59
3 changed files with 211 additions and 142 deletions

View file

@ -31,10 +31,10 @@ Requires Python 3.11 or newer. The core only needs rich. Reading and writing emb
## Command Line Tool
```
$ otag <command> [arguments ...] [flags]
$ otag <command> [flags] [arguments ...]
```
Every command has a short alias, listed in brackets. `otag -h` prints an overview. Words starting with `+`, `@` or `#` become projects, contexts and tags; all other words form the note. Quote hashtags in the shell (`'#lofi'`), because an unquoted `#` starts a comment.
Every command has a short alias, listed in brackets. `otag -h` prints an overview, `otag <command> -h` the arguments and flags of one command; flags go after the command. Words starting with `+`, `@` or `#` become projects, contexts and tags; all other words form the note. Quote hashtags in the shell (`'#lofi'`), because an unquoted `#` starts a comment.
### Tagging
@ -74,7 +74,7 @@ A term with a prefix only matches that category; a term without a prefix matches
### Copying, Moving and Deleting
`copy` (`cp`) and `move` (`mv`) transfer the tags of a file to another path. By default only the tags are transferred; `-f` (`--file-operation`) also copies or moves the file itself. With `-f`, an existing folder as destination keeps the file name. Without `-f`, a folder as destination gets the tags itself.
`copy` (`cp`) and `move` (`mv`) transfer the tags of a file to another path. By default only the tags are transferred; `-f` (`--with-file`) also copies or moves the file itself. With `-f`, an existing folder as destination keeps the file name. Without `-f`, a folder as destination gets the tags itself.
```
$ otag cp song.mp3 song-copy.mp3