5 stable releases

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

#135 in Filesystem

Download history 244/week @ 2024-09-20 51/week @ 2024-09-27 7/week @ 2024-10-04 7/week @ 2024-10-11 3/week @ 2024-10-18 115/week @ 2024-10-25 27/week @ 2024-11-01 121/week @ 2024-11-08 19/week @ 2024-11-15 133/week @ 2024-11-22 12/week @ 2024-11-29

290 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

~3–10MB
~103K SLoC