5 stable releases

new 1.2.0 Nov 24, 2024
1.1.1 Nov 11, 2024
1.1.0 Oct 27, 2024
1.0.1 Sep 22, 2024

#141 in Filesystem

Download history 219/week @ 2024-09-18 71/week @ 2024-09-25 10/week @ 2024-10-02 6/week @ 2024-10-09 6/week @ 2024-10-16 107/week @ 2024-10-23 26/week @ 2024-10-30 117/week @ 2024-11-06 27/week @ 2024-11-13

277 downloads per month

MIT license

27KB
626 lines

bookmark-cli

A command-line tool for managing bookmarks of directories.

Overview

This tool aims to allow users to save paths to specific directories as bookmarks, making it easy to access them later. Users can add, search, list, and delete bookmarks.

Bookmarks are stored in a hidden file (~/.bookmarks).

demo

Requirements

  • rustc and cargo

Installation

cargo install bookmark-cli

Usage

Command Description
add Add a bookmark
delete Delete a bookmark
search Search for a bookmark
list List bookmarks
prune Delete all broken bookmarks
help Print this message or the help of the given subcommand(s)

Adding a Bookmark

bm add [bookmark path] [--tags tag1,tag2,...]

The bookmark path must be an absolute path.

If you do not specify [bookmark path], the current directory will be registered as a bookmark.

You can also add tags to the bookmark using the --tags option. Tags should be comma-separated.

Searching for a Bookmark

bm search

A search prompt will appear, allowing you to filter and select a bookmark.

Listing Saved Bookmarks

bm list

All bookmarks will be displayed.

Deleting a Bookmark

bm delete

A prompt will appear for you to select the bookmark you want to delete.

Deleting Broken Bookmarks

bm prune

All broken bookmarks, i.e. bookmarks that no longer exist, will be deleted.

Moving to a Bookmark

You can move to a selected bookmark by combining it with the cd command.

If you are using zsh, you can add a function to your ~/.zshrc.

For example:

function cb() {
  local -r dir=$(bm search)
  if [ -z "$dir" ]; then
    return 1
  fi
  cd "$dir" || return 1
}

Dependencies

~2.9–10MB
~98K SLoC