okini
[Japanese]
A CLI tool for bookmarking local file paths
Installation
go install github.com/AWtnb/okini@latest
or
go install
after cloning this repo.
Usage
Adding Bookmarks
# Specify path only (name will be the final path element)
okini --add /path/to/file
# Specify custom name
okini --add /path/to/file myfile
If a bookmark with the same name already exists, both the existing and new bookmarks will be automatically annotated with their full paths to avoid conflicts. For example:
- Existing:
cc → becomes cc <= /aaa/bb/cc
- New:
cc → becomes cc <= /dd/ff/cc
Removing Bookmarks
# Remove by path
okini --remove /path/to/file
# Remove by name
okini --remove myfile
The --remove command can remove bookmarks by either path or name:
- If the argument is a path, it removes by path
- Otherwise, it removes by name
This will remove all bookmarks matching the specified path or name.
After removal, if a bookmark no longer has name conflicts, its annotation will be automatically simplified. For example:
- Before removal:
aa <= C:/Users/username/Desktop/aa and aa <= C:/Users/username/Desktop/bb/aa
- After removing one:
aa (annotation removed since there's no conflict anymore)
Listing Bookmark Names
okini --list
This is designed to be piped to tools like fzf.
Getting Path by Name
okini --search myfile
Command-line Examples
Basic usage:
# Add bookmarks
okini --add /path/to/file
okini --add /path/to/file myfile
# Remove by path or name
okini --remove /path/to/file # Remove by path
okini --remove myfile # Remove by name
# List and search
okini --list
okini --search myfile
With fzf:
Unix/Linux/macOS:
okini --list | fzf | xargs okini --search
Windows (PowerShell):
okini --search (okini --list | fzf)
Combined Usage with fzf
Select a bookmark and get its path:
Unix/Linux/macOS:
okini --list | fzf | xargs -I {} okini --search {}
Windows (PowerShell):
okini --search (okini --list | fzf)
Navigate to selected path:
Unix/Linux/macOS:
cd $(okini --list | fzf | xargs -I {} okini --search {})
Windows (PowerShell):
cd (okini --search (okini --list | fzf))
Registering as an alias is convenient:
Bash/Zsh (add to .bashrc or .zshrc):
alias cdoki='cd $(okini --list | fzf | xargs -I {} okini --search {})'
PowerShell (add to $PROFILE):
function cdoki { cd (okini --search (okini --list | fzf)) }
Data Storage Location
Bookmark data is stored in the following directories:
- Linux:
~/.config/okini/bookmarks.json
- macOS:
~/Library/Application Support/okini/bookmarks.json
- Windows:
%AppData%\okini\bookmarks.json
[
{
"name": "myfile",
"path": "/absolute/path/to/file"
},
{
"name": "documents",
"path": "/home/user/Documents"
}
]