Skip to main content

A tool to temporarily save and go to a working directory

Project description

twd-m4sc0

twd-m4sc0 is a command-line tool that allows you to temporarily save a working directory and easily navigate back to it. It's designed for developers and users who frequently need to switch between directories in the terminal.

Features

  • Save the current or specified working directory.
  • Go back to a saved directory using an optional alias.
  • List all saved directories with metadata.
  • Unset and delete saved directories.
  • Integrates with your shell for seamless directory management.

Installation

Installation using pip:

  1. Install the package from the pypi repository:
pip install twd-m4sc0
  1. Add the following line to your .bashrc or .zshrc to set up the shell function:

Since 1.5.4 you can also set a different command for the twd program by replacing [alias] in the following code by your custom alias

eval $(python3 -m twd --shell [alias])
  1. Exit and reopen the terminal or reload using:
source ~/.bashrc
# or
source ~/.zshrc

Usage

Save a directory

  • Save the current directory or a specified directory:
twd -s [path] [alias]

If no path is specified, the current directory is saved. The alias is optional, and if not provided, an auto-generated ID will be used.

Go to a saved directory

  • Navigate to a saved directory using an optional alias:
twd -g [alias]

If no alias is provided, the most recently saved directory will be used. If an alias is provided, it will navigate to the directory associated with that alias.

List saved directories

  • Display a list of all saved directories:
twd -l

Unset the TWD and delete the data file

  • Unset and delete the saved directories:
twd -u

You can force this action using the --force flag to avoid accidental execution.

twd -u --force

Optional Parameters

Simple Output

For cleaner, minimal output intended for scripting or piping.

  • Example with --simple-output:
twd -s --simple-output
/home/user/.config
  • Example without --simple-output:
Saved TWD to /home/user/.config

No Output

Suppresses all output (including confirmation messages).

  • Example with --no-output:
twd -s --no-output
# No output

Force

Use the --force flag to force certain actions, such as when unsetting directories with the -u flag.

  • Example:
twd -u --force
TWD File deleted and TWD unset

Contribution

To set up a development environment:

  1. Clone the repository:
git clone https://github.com/m4sc0/twd
cd twd
  1. Install the package in editable mode using pip:
pip install -e .
  1. Make your changes, and contribute!

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

twd_m4sc0-1.5.4.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

twd_m4sc0-1.5.4-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file twd_m4sc0-1.5.4.tar.gz.

File metadata

  • Download URL: twd_m4sc0-1.5.4.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for twd_m4sc0-1.5.4.tar.gz
Algorithm Hash digest
SHA256 cf3eb88751161b6512558111e0354bb72fd3a5b6a88a4515f017f8eded841c97
MD5 76d01a4c9b4e9d18285988de11328e85
BLAKE2b-256 6dbfac3030af1fa2fd8110f1e0ad2ab1cfbdf1cc182ebc26e5e99743a6effa0c

See more details on using hashes here.

File details

Details for the file twd_m4sc0-1.5.4-py3-none-any.whl.

File metadata

  • Download URL: twd_m4sc0-1.5.4-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for twd_m4sc0-1.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ffb2f97a91c5f58f62c944d655b6a32121501f70e82218e5caaf04496ba4e231
MD5 d1e970e4e84a0c6bcbe5b32b3e72c72a
BLAKE2b-256 26a9bad4684c49b490cfe9ed1d7a7bedee3f7d871bf9670df4b866eab5f16120

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