Skip to main content

Bookmarks for the filesystem

Project description

Dirmarks

Dirmarks is a directory bookmarking tool that allows you to easily manage, navigate, and switch between directories using bookmarks. This tool can save you time and make working with the command line more efficient.

Installation

Install the Markdirs package using pip:

pip install dirmarks

Shell Function Setup

To enable the dir command for changing directories using bookmarks, add the following shell function to your .profile, .bashrc, or .zshrc file, depending on your shell:

#!/bin/bash
dir() {
if [ $# -eq 0 ]; then
    dirmarks --list
    return
fi
OPT=$1;
shift;
case $OPT in
        -l)
        dirmarks --list
        ;;
        -h)
        dirmarks --help
        ;;
        -d)
        dirmarks --delete $1
        ;;
        -m)
        dirmarks --add $1 "$PWD"
        ;;
        -u)
        dirmarks --update $1 "$2"
        ;;
        -a)
        dirmarks --add $1 "$2"
        ;;
        -p)
        GO=$(dirmarks --get $1);
        if [ "X$GO" != "X" ]; then
                echo $GO;
        fi
        ;;
        *)
        GO=$(dirmarks --get $OPT);
        if [ "X$GO" != "X" ]; then
                cd "$GO";
        fi
        ;;
esac
}

Or add a file .functions in your home directory and source it in .bashrc

echo "source ~/.functions" >> ~/.bashrc

Setup dirmarks for all users

mkdir -p /etc/bash.functions 
cp data/marks.function /etc/bsh.fucntions

Append the following line in /etc/bash.bashrc

if [ -d /etc/bash.functions ]; then
        for i in /etc/bash.functions/*;do 
                source $i
        done
fi

Usage:

dir -h   ------------------ prints this help
dir -l	------------------ list marks
dir <[0-9]+> -------------- dir to mark[x] where is x is the index
dir <name> ---------------- dir to mark where key=<shortname>
dir -a <name> <path> ------ add new mark
dir -d <name>|[0-9]+ ------ delete mark
dir -u <name> <path> ------ update mark
dir -m <name> ------------- add mark for PWD
dir -p <name> ------------- prints mark

Usage example

majam@dirose:~$ dir -l
0 => meirm:/net/xen/mnt/sdb1/meirm
1 => edonkey:/net/xen/mnt/sdb1/majam/aMule/Incoming
2 => init:/etc/init.d
3 => majam:/net/xen/mnt/sdb1/majam

majam@dirose:~$ dir 1
majam@dirose:/net/xen/mnt/sdb1/majam/aMule/Incoming$ 

majam@dirose:/etc/init.d$ dir majam
majam@dirose:/net/xen/mnt/sdb1/majam$ 

majam@dirose:~$ dir -d 2
majam@dirose:~$

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dirmarks-0.1.8.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dirmarks-0.1.8-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file dirmarks-0.1.8.tar.gz.

File metadata

  • Download URL: dirmarks-0.1.8.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.8 Darwin/24.4.0

File hashes

Hashes for dirmarks-0.1.8.tar.gz
Algorithm Hash digest
SHA256 3e600bfae2ecb0b33a423349432ef6c496c6a630f67832c27ee6dc6bf1adcd9c
MD5 4cee571b2dc8c3b0b11e89a784359536
BLAKE2b-256 4af97e54382ea7fe6e4ca53810a0360286762cb3325c5cc18684a44443dfeb57

See more details on using hashes here.

File details

Details for the file dirmarks-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: dirmarks-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.8 Darwin/24.4.0

File hashes

Hashes for dirmarks-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 dc409249936c16794692713b7995c7d4128929ed7f2c56f72450989be7404d77
MD5 e71d49c5cb09d731c2973c039af4d815
BLAKE2b-256 e13e1d193c0d5b5d64bb5100fd9fad50256fe8d09246afefc6bf8fa56da4a1ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page