Skip to content

fezcode/bm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BM - Bookmark Manager

A Simple Bookmark Manager for Your Shell.

Creates ~/.bm directory to store store.toml file which contains your bookmarks in toml format.

Commands

Command Description
bm a/add <name> Adds current directory to bookmarks.
bm a/add <name> <directory> [option] Adds given directory to bookmarks.
bm s/show Show all bookmarks.
bm s/show <name> Show bookmark associated with given name.
bm d/delete <name> Delete bookmark with given name.
bm h/help Prints help text.
bm -h/--help Prints help text.
bm v/version/-v/--version Prints version information.
bm debug <any full command> For any command, activates debug mode, if any debug prints are available.

Add Options

   -a, --add-anyway
       Adds path to bookmarks even if it does not exist
   
   -o, --overwrite
       Overwrites bookmark with new given value if a bookmark with
       same name exists.
       
   -d, --directory-only
       Add bookmark if it is directory only. If -f is provided last, -f will be used.
       
   -f, --file-only 
       Add bookmark if it is file only. If -d is provided last, -d will be used.

Show Options

   -p, --pretty
       When priting all files, via `bm show`, giving this option prints output
       in table format.

Examples

1. Add directory to bookmarks

# Add directory 
$ bm a HOME_DIR ~ 
# Add current directory
$ bm a HOME_DIR 

2. Change directory to HOME_DIR

Linux

$ cd `bm s HOME_DIR`
# or
$ cd $(bm s HOME_DIR)

Windows

$ cd $(.\bm s HOME_DIR)
# or
$ bm s HOME_DIR | cd

3. Show all bookmarks

$ bm s
# or pretty print
$ bm s -p

4. Delete bookmark

$ bm d HOME_DIR 

5. Add path to bookmarks if given path is path of a file

$ bm d FILE_PATH file.txt -f

6. Add path to bookmarks if given path is path of a directory

$ bm d DIR_PATH /path/to/dir -d

7. Print additional information via Debug command

$ bm debug add PATH /path

Building Project

In order to build project, run

$ cargo build

To run project,

$ cargo run --package bm --bin bm

Creating Debian Package

  1. First install cargo-deb package
   cargo install cargo-deb 
  1. Add metadata to Cargo.toml
[package.metadata.deb]
maintainer = "Username <username@example.com>"
copyright = "Copyright (c) 2022 Username <username@example.com>"
  1. Run cargo deb
cargo deb

Creating RPM Package

Install

cargo install cargo-generate-rpm

Usage

cargo build --release
strip -s target/release/XXX
cargo generate-rpm

Configuration

[package.metadata.generate-rpm]
    name: the package name. If not present, package.name is used.
    version: the package version. If not present, package.version is used.
    license: the package license. If not present, package.license is used.
    summary: the package summary/description. If not present, package.description is used.
    assets: (mandatory) the array of the files to be included in the package
        source: the location of that asset in the Rust project. (e.g. target/release/XXX) Wildcard character * is allowed.
        dest: the install-destination. (e.g. /usr/bin/XXX) If source contains wildcard character *, it must be a directory, not a file path.
        mode: the permissions as octal string. (e.g. 755 to indicate -rwxr-xr-x)
        config: set true if it is a configuration file.
        doc: set true if it is a document file.
    release: optional string of release.
    epoch: optional number of epoch.
    pre_install_script: optional string of pre_install_script.
    pre_uninstall_script: optional string of pre_uninstall_script.
    post_install_script: optional string of post_install_script.
    post_uninstall_script: optional string of post_uninstall_script.
    requires: optional list of Requires
    auto-req: optional string "no" to disable the automatic dependency process
    obsoletes: optional list of Obsoletes
    conflicts: optional list of Conflicts
    provides: optional list of Provides

Location

target/generate-rpm/XXX.rpm

Source