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.
All Versions
< v1.5
are considered deprecated and should not be used anymore because of theconfig
file that was introduced in that version. This file is incompatible with newer versions and might cause issues or break the program.
- 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.
- Some options can be configured using the
config
file. For more information please visit the Config documentation.
- Install the package from the
pypi
repository:
pip install twd-m4sc0
- Ensure proper installation by checking the version
python3 -m twd -v
This setup information is only recommend if you're system is using the
.bashrc
file provided by debian based systems and it's located at~/.bashrc
. If you're unsure what you're shell configuration file is called or where it's located please refer to your official OS documentation to ensure proper functionality.
- Run the following command to activate the
twd
shell function
Replace
[alias]
with an alias of your choice to customize the way you're calling the script and follow the given instructions
python3 -m twd --setup [alias]
- Add the following line to your shell configuration file:
eval $(python3 -m twd --shell [alias])
- Run the following command to apply the new configuration:
source ~/.bashrc
or
source ~/.zshrc
- 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.
- 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.
- Display a list of all saved directories:
twd -l
- Unset and delete the saved directories:
twd -u
You can force this action using the --force
flag to avoid accidental execution.
twd -u --force
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
Suppresses all output (including confirmation messages).
- Example with
--no-output
:
twd -s --no-output
# No output
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
To set up a development environment:
- Clone the repository:
git clone https://github.com/m4sc0/twd
cd twd
- Install the package in editable mode using
pip
:
pip install -e .
- Make your changes, and contribute!