Better cd
ing for macOS
Explore the docs ยป
Report Bug
ยท
Request Feature
Please star this repo if you found this tool useful ๐
fcd
is a utility which helps you cd
faster on macOS.
Ever had to type out a long cd ~/Sites/Projects/project
, find out the path is wrong, rewrite it to cd ~/Sites/Sandbox/project
? You just wasted a minute or two.
This inspired me to create this tool: fcd
.
fcd
automatically reads the dirname and the basename of the input and searches for any folder with basename as the name in the dirname folder (Basically, if you input "some/where/else"
, the program returns the path to "some/where/**/else"
). Once it finishes:
- If there is more than one folder named basename, it gives you a list of options to choose from, then it copies the
cd <path-to-folder>
command to your clipboard. - If there is only one folder named basename, it directly copies the
cd <path-to-folder>
command to your clipboard.
I originally meant to automatically execute the cd <path-to-folder>
command, but then I realized that it is impossible, so the cd <path-to-folder>
command is copied to clipboard instead.
To get a local copy up and running follow these simple steps.
You need to have Node.js (and npm) installed.
- Install using npm
$ npm i -g fcd
- Be more productive ๐
$ fcd ./project
$ fcd path/to/search/foldername-to-search-for
For more examples, please refer to the Documentation
The usage of this cli is very simple. It boasts two commands:
- The
fcd
command - The
fcd-config
command
fcd
takes one argument "path"
to search. You can optionally use the "-v"
/"--verbose"
option to run it in verbose mode, which shows you all the searched folders.
Example:
$ fcd path -v
The fcd-config
command is used to configure the fcd
command. It currently has only configurable three options:
ignoredFolders
: List of folders to be ignored. Defaults tonode_modules,Trash,Library
ignoreDotFolders
: Whether to ignore.folders
like.git
or.bin
. Defaults totrue
addNewlineToCopy
: Whether to add a newline to the copiedcd
command. When set totrue
, the copiedcd
command will automatically run when pasted and vice-versa. Defaults totrue
There are quite a few sub-commands, namely:
-
get <key>
: Used to get the value of a configuration.Example:
$ fcd-config get ignoredFolders fcd SUC! `ignoredFolders`: `["Trash","node_modules","Library"]` $ fcd-config get ignoreDotFolders fcd SUC! `ignoreDotFolders`: `true`
-
set <key> <value>
: Used to set the value of a configuration.set
ting completely overwrites the previous configuration. If you meant to add a value to, for example,ignoredFolders
use theadd
command.Example:
$ fcd-config set ignoredFolders Trash,node_modules,Library,Music fcd WARN! Setting array values directly will overwrite all values fcd WARN! not add to them. Use the add command if you meant to add fcd SUC! Set `ignoredFolders` to `Trash,node_modules,Library,Music` $ fcd-config set ignoreDotFolders false fcd SUC! Set `ignoreDotFolders` to `false`
-
add <key> <values...>
: Used to add a value to a configuration with an array as a value.This command can currently be used only for the
ignoreDotFolders
setting. If you set any other property using this command, that setting will becomefalse
, even if the success message does not say so.Example:
$ fcd-config add ignoredFolders Music fcd SUC! Added `Music` to `ignoredFolders` $ fcd-config add ignoreDotFolders true fcd SUC! Added `true` to `ignoreDotFolders` $ fcd-config get ignoreDotFolders fcd SUC! `ignoreDotFolders`: `false`
-
path
: Used to get the path to the configuration file (JSON)Example:
$ fcd-config path fcd SUC! Path: `/Users/apple/Library/Preferences/fcd-nodejs/config.json`
-
reset [keys...]
: Used to reset all keys or the provided keys to their default valuesExample:
$ fcd-config reset ignoredFolders fcd SUC! `ignoredFolders` reset successfully $ fcd-config reset ignoredFolders,ignoreDotFolders fcd SUC! `ignoredFolders,ignoreDotFolders` reset successfully $ fcd-config reset fcd SUC! Config reset successfully
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Discuss the contribution
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
More info is available in the CONTRIBUTING file
Distributed under the GNU GPL-3.0 License. See LICENSE
for more information.
Siddharth Shyniben - [email protected]
Project Link: https://github.com/SiddharthShyniben/fcd