-
Notifications
You must be signed in to change notification settings - Fork 0
Features
$ dir
Just run dir
. You will be asked to select one of the bookmarked directories.
After picking a directory, your shell is cd
to it thereafter.
It's a quick way one can change their working directory to another among a list of common directories they use.
dir
now has a driller feature. Use it by passing a directory as the first argument to dir
. For example, to get a dir picker using your current working directory, run dir .
. Similarly, it is possible to pass dir ..
to get a picker for one directory upward.
The driller (using find
) will locate every shallow subdirectory from the specified folder and present it to you.
If only one directory exists, dirp will automatically switch to it, using the -1
option of fzf
.
Right now, the only way to add bookmarks is by editing the Config file. Assuming the EDITOR
environment variable is set to your text editor, dir cfg
can be used to pull up the config file. The command interpreter should be modified to facilitate bookmarks via routine invocations.
The remaining design consideration is to provide a suitable interface for specifying the folder's label.
Users should not call dirp
directly. Doing so only reveals how the program works. If you check the output from dirp
when invoked directly, you always see a file path of some kind after making a choice.
Perhaps the only legit use for direct invocation is calling dirp cfg
, which shows the path to the config file. This is merely an accident, as it is an implementation detail for the dir cfg
command.
Future versions of dirp
may add special behavior for direct invocation, but right now, there is simply no use for it. That is, always use dir
, the shell function, as your entrypoint to the dirp
software. See Design for more detail on the implementation being a function.
Internally, dir
uses pushd where available, which means you can continuously use popd
to trace your way back through the folders you were in before.
As always, cd -
can also be used as an alternative to popd
. But note that cd -
merely does a binary swap operation, whereas popd
is a stack.
The default behavior of this program is to preserve all of the folders on the stack, so that users can popd
their way back to freedom.
Shells that support a directory stack come with a dirs
builtin. See help dirs
for usage.