Skip to content

tamada/sibling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sibling

build Coverage Status

Rust Report Card

License Version

get the next/previous sibling directory name.

🗣️ Description

When a directory has too many sub-directories, we are tiresome to traverse the whole of sub-directories. Because, sometimes we lose where we are. Ideally, we move the directory by specifying ‘next’ or ‘previous,' not the directory name.

The command like the following makes us tired 👎.

cd ../next_directory_name

We should type the command like below 👍.

cdnext

For this, I implemented sibling.

Utility commands

The sibling introduces the following utility commands.

  • change the working directory to the sibling directory:
    • cdnext,
    • cdprev,
    • cdfirst,
    • cdlast, and
    • cdrand
  • list the sibling directory:
    • lsnext,
    • lsprev,
    • lsfirst,
    • lslast, and
    • lsrand

The cdnext and the cdprev allow the integer argument to repeat the traversing.

🏃 Usage

get next/previous sibling directory name.

Usage: sibling [OPTIONS] [DIR]

Arguments:
  [DIR]  the directory for listing the siblings [default: .]

Options:
  -a, --absolute      print the directory name in the absolute path
  -l, --list          list the sibling directories
  -p, --progress      print the progress of traversing directories
  -P, --parent        print parent directory, when no more sibling directories
  -s, --step <COUNT>  specify the number of times to execute sibling [default: 1]
  -t, --type <TYPE>   specify the nexter type [default: next]
                      [possible values: first, last, previous, next, random, keep]
  -h, --help          Print help
  -V, --version       Print version

sibling prints the next directory name with 0 status code. The next directory is decided by the traversing type. Available values are: next, previous, first, last, keep and random, default is next.

After visiting the final directory, the sibling prints nothing and exits with a non-zero status code.

⚓ Installation

🍺 Homebrew

Install sibling via Homebrew, simply run:

brew tap tamada/brew
brew install sibling

And put the following snipeets into your shell profile (e.g., .bash_profile, or .zshrc) The --init option accepts only bash. Other shell scripts are not supported, yet.

eval "$(sibling --init bash)"

💪 Compiling yourself

Get source codes by git clone or download from GitHub, then run cargo build to build sibling.

$ git clone https://github.com/tamada/sibling.git # or download from https://github.com/tamada/sibling
$ cd sibling
$ cargo build --release # the binary file is put on target/release/sibling.

💼 Requirements

Development

  • Rust 1.78 or later
  • Dependencies (See Cargo.toml)
    • clap 4.5.5
    • rand 0.8.5
    • rust-embed 8.4.0

😄 About the project

📜 License

  • WTFPL
    • 👍 Commercial use
    • 👍 Modification
    • 👍 Distribution
    • 👍 Private use

👨‍💼 Developers 👩‍💼

🔗 Useful links for directory traversing