cdargs (1) - Linux Manuals
cdargs: bookmarks and browser for cd shell built-in
NAME
cdargs - bookmarks and browser for cd shell built-inSYNOPSIS
cdargs [OPTIONS]function cv () {
cdargs $1 && cd `cat $HOME/.cdargsresult` ;
}
cv [Needle]
DESCRIPTION
With cdargs you can jump to various places throughout the file-system that are defined using a plain text, line oriented bookmarks file.You can create bookmarks by editing your bookmarks file "$HOME/.cdargs" using your favorite editor, by using the "--add" option to cdargs or by using the built-in mechanism that will be described later.
While you are in cdargs you can use various commands to navigate through your list of bookmarks and through the file-system. These are described below in the section "COMMANDS". The most commonly used and most obvious commands are the up/down keys for navigation, "ENTER" for selection of a path and "q" for quit.
To be able to actually use this program together with the shell built-in "cd" command you must use a little trick by defining a shell function. Of course the syntax for this is different between the csh-like shells (like tcsh) and the sh-like shells (like bash).
For sh-like shells:
For csh-like shells:
Now you only have to put the
cdargs
binary somewhere into your path.
Of course you can create functions and/or aliases for different
purposes. You might want to add a pwd call to echo your current
directories or put --nowrap in your functions to enable a different
scrolling behavior. See section SHELL FUNCTIONS below.
Since version 1.19 cdargs brings a collection of bash functions (and
since 1.20 tcsh aliases, too) with it. You only have to source this
in your ~/.profile or ~/.bashrc (or ~/.tcsh) and you get nice kinds of
magic prepared (completion...). Please read the cdargs-bash.sh or
cdargs-tcsh.csh respectively for the documentation of these functions.
The Needle is examined in the following order and the first
thing that fits is taken.
If Needle is a one-digit integer the appropriate entry is
preselected.
Otherwise if Needle is a string each entry of the
list is checked whether it contains Needle.
Then Needle has two functions:
If it exactly matches a description string this is the result
(that means cdargs closes the curses window, exits and the changing
of directories takes place).
And to make things even more complicated you can affect this behavior
by using the "--noresolve" option. This option is used when you think
you give a Needle which matches descriptions exactly but you don't
want it to be resolved if it does. This option is internally turned on
when you delete an entry (otherwise the deletion of entries until only
one entry is left would lead to resolving) or when the bookmarks file
contains only one entry.
Finally, if the filtered list (but not the bookmarks file) contains
only one entry it is selected and the program exits successfully,
unless you chose --noresolve.
I can only hope that you understand this nested if babble...
Please note, that the existence of a Needle disables the saving
of the list at the end of the program.
The two modes are LIST (when your bookmark list is displayed) and
BROWSE (when you navigate through the file-system).
The navigation keys are mostly available in Emacs and vi style for all
maniacs out there.
Common Keys
Keys in BROWSE mode
Keys in LIST mode
function cv () {
Or you can remove the file in which
cdargs
reports it's result:
function cv () {
Since version 1.19 cdargs comes with a file of preset functions for
bash: see cdargs-bash.sh in the distribution. From now on you
only have to source that file if you are using a sh-like shell.
Then you can use the shell completion to switch directories even
faster by typing
cv [TAB]
Since version 1.20 cdargs comes with a file of rudimentary aliases
(and completion) for the tcsh.
The second line from the bottom is a status line which shows the
current directory and a one letter code for the current operation
mode:
The largest part of the display is used to show you either the list of
your bookmarks or the contents of the current directory. On the left
side you'll probably find a number which you can use for a slightly
quicker jumping compared to using the cursor movement. These numbers
can be moved as described above. Next comes the short description of
an entry in brackets. This is convient when you have quite long paths
in your bookmarks and most of them start with the same base (e.g.
/home/user). Finally there is the actual absolute path you'll be
warping to when finishing. Obviously the current entry is
highlighted.
If the path is preced by a "!" it points to an invalid directory. A
bookmark pointing to the current working directory is displayed in
bold font (if the terminal emulation understands that attribute).
cdargs
is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
You might want to visit that site. Other than that pressing the 'H'
key in
cdargs
fires up a help screen.
function cv () {
}
alias cv 'cdargs \!* && cd `cat $HOME/.cdargsresult`'
COMMAND-LINE OPTIONS
You can call
cdargs
with a few options, but otherwise you probably won't call it directly
but via the function you defined.
If it just matches a substring of either path or description that
option is placed in the list.
COMMANDS
When you are in
cdargs
you have two modes and several commands at your hands.
SHELL FUNCTIONS
In addition to the shell function mentioned above you might wish to
add other commands to your function. One example is to echo the
directory you changed to:
}
}
Any volunteers for porting all the bash functionality to tcsh
are welcome.
DISPLAY
The
cdargs
window has one line at the bottom for the display of messages like
when you added to your list or when you hit an unknown key.
FILES
$HOME/.cdargs
personal bookmarks file.
REPORTING BUGS
Report bugs to <mail [at] skamphausen.de>.
AUTHOR
cdargs
was written by Stefan Kamphausen with add-ons by Claus Brunzema.
Many user-interface improvements came from Dan Allen.
COPYRIGHT
Copyright © 2001-2003 Stefan Kamphausen
SEE ALSO
The current version of
cdargs
is located at