A CLI bookmarking & shortcuts utility
(c) 2012 Jason Daly firstname.lastname@example.org (http://deefour.me)
Released under the MIT License.
speed-dial is a CLI bookmarking & shortcuts utility, allowing you to alias and index directory paths within 'entry groups', manage directory 'listings' (speed-dial will list out the children of a 'listing' and ask which you'd like to make your new current working directory), and swap your current working directory quickly by targeting entries or listings.
Node 0.6+ or greater is required to run speed-dial. speed-dial has so far only been tested on Mac OS.
npm install speed-dial --global
speed-dial init. Specify the path to a file of your choice that your terminal sources.
~/.zsh_profileare good choices for bash and zsh users respectively
init command sources a bash script from the package making a few commands to interact with speed-dial available.
sd: The main speed-dial interface
s: Shortcut to
sd go [alias|id]
s commands should be your sole method for interacting with speed-dial. Technically you can interact with speed-dial without issue using the provided
speed-dial binary directly, however when calling
speed-dial go [...] no redirection will occur on exit of the script.
speed-dial should not be run directly using the node package's
There is an inherent issue trying to change the terminal's current working directory from within a child process. Changing the current working directory from within speed-dial only changes the directory of the child process speed-dial is running within and only for the duration of the script's execution. Once speed-dial finishes execution, returning focus back to the main terminal's process, the current working directory will remain as it was prior to executing the speed-dial command.
speed-dial works around this limitation by writing the target directory to a file in
/tmp just before it's process exits. When calling speed-dial through the available shell functions, the target directory is read from the
/tmp file and the appropriate
cd [target directory] command is executed directly within the terminal's process.
If anyone would like to suggest a better (and multi-user-friendly) alternative, please create an issue or send a pull request.
Like git, the speed-dial command delegates to subcommands based on its first argument. The most common subcommands are:
Should only be run once, immediately after installing the speed-dial node package. A line like the following one is appended to the file you specify when prompted.
# Loads speed-dial functions. /path/to/system/node_modules/speed-dial/assets/functions
Prints the currently installed version of speed-dial.
sd list [group] [options]
Lists the SpeeDial entries for all groups and listings if no
[group] is specified.
--raw can be passed to
[options] to print a prettyjson dump of the raw speed-dial JSON storage in it's entirety.
sd list # lists all entries and listings by groupsd list default # lists the entries for the default groupsd list work # lists the entries for the 'work' groupsd list listings # lists the 'listings' entriessd list work --raw # lists the raw speed-dial JSON storage for the 'work' group
list command is executed, directly by you or internally by speed-dial, the entries are ordered by the following criteria
sd group [name]
Prints the name of the currently active group if
[name] is not provided. If
[name] is provided, speed-dial's currently active group will be changed.
sd group # prints 'default'sd group work # changes currently active group to 'work'sd group # prints 'work'
When running a command like
sd go [alias|id] (or
s [alias|id] for short), speed-dial will restrict it's lookup to the currently active group. By switching the active group as you shift focus throughout the day, you can avoid the need to pass the group name to
s when performing a lookup.
sd add [path] [alias] [options]
sd add ~/Sites/Deefour.me # Adds /Users/deefour/Sites/Deefour.me to the currently active group with no aliassd add ~/Documents docs # Adds /Users/deefour/Documents to the currently active group with alias 'docs'sd add ~/Work/Project1 --group work # Adds /Users/deefour/Work/Project1 to the 'work' group with no aliassd add ~/Work/Project2 p2 --group work # Adds /Users/deefour/Work/Project2 to the 'work' group with alias 'p2'sd add ~/Media/Audio/iTunes mp3s --weight 4 # Adds /Users/deefour/Media/Audio/iTunes to the currently active group with a weight of 4
Adds a new entry to speed-dial. The
[alias] is optional, as speed-dial can lookup an entry based on it's ID within it's group by running
s [entry ID] (this is explained more in
sd go below).
sd addlisting [path] [alias]
Adds a new listing to speed-dial. Both
[alias] are required. Note: Listing aliases must be unique to other listing aliases and from all group names.
sd addlisting ~/Sites sites # adds a new listing with alias 'sites' for path '/Users/deefour/Sites`
Lists all entries by group and all listings, with an incrementing ID value that is not reset for each group or the listings. Prompts for the ID value corresponding to the entry or listing to be removed. After confirmation, the entry or listing will be removed from the speed-dial storage.
For a user-created entry group, if no entries remain in the group after the one specified was removed, the user-created entry group will be removed from the speed-dial storage too.
sd go [group|alias|ID] [alias|ID]
sd go # Lists all entries and listings, prompting the user to select onesd go work # Lists all entries for the 'work' entry group, prompting the user to select onesd go listings # Lists all listings, prompting the user to select onesd go listing sites # Lists the child directories of the path associated with the 'sites' alias listing, prompting the user to select onesd go me # (Assuming 'me' is an alias in the curently active group) Switches the current working directory to the path associated with the 'me' alias in the currently active groupsd go work 1 # Switches the current working directory to the entry associated with ID '1' in the 'work' entry group
This command obeys the following logic
The bash command function
s is provided as a shortcut to
sd go. Since speed-dial is about minimizing keystrokes required to change a directory, it's recommended you always use
s in favor of
Given a speed-dial listing as follows
➜ ~ ✗ sinfo:info: Entry Group: default (active)info:info: 1 one /Users/deefour/Sites/Oneinfo: 2 two /Users/deefour/Sites/Twoinfo: 3 three /Users/deefour/Sites/Threeinfo:info: Entry Group: workinfo:info: 4 proj /Users/deefour/Work/Projinfo: 5 two /Users/deefour/Work/Two
If the following lookup was performed
➜ ~ ✗ s projerror: The target proj does not match any alias in the default group
The lookup would fail. This can be annoying since the
proj alias does exist, just not in the active group.
To alleviate this frustration while still allowing for the clean organization of aliases within groups, you can set the
globalLookupFallback config option to
➜ ~ ✗ sd config set globalLookupFallback true
Now the lookup will treat all aliases as though they were in a single group.
➜ ~ ✗ s projinfo: The /Users/deefour/Work/proj path from the work group with scms has been selectedinfo: The current working directory is now /Users/deefour/Work/proj
Note: The first alias matched will be used. This means in the above example if the alias
two was searched, it will only ever match the entry in the
default group unless the
work group is active or specified on the command line through
s work two (in which case the
globalLookupFallback is ignored anyway).
Fixes issue with speed-dial not being able to write to
fs.writeFileis being used instead of manually opening, writing to, and closing the file in
globalLookupFallback now available (see
README.md for details)
JShint now in place
Initial project release