Skip to content

SiddharthShyniben/fcd

Repository files navigation

Contributors Forks Downloads Stargazers Issues MIT License


>_

fcd

Better cding for macOS
Explore the docs »

Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Documentation
  5. Roadmap
  6. Contributing
  7. License
  8. Contact

About The Project

Please star this repo if you found this tool useful 🌟

fcd Screen Shot

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.

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

You need to have Node.js (and npm) installed.

Installation

  1. Install using npm
  $ npm i -g fcd
  1. Be more productive 😄
  $ fcd ./project

Usage

$ fcd path/to/search/foldername-to-search-for

For more examples, please refer to the Documentation

Documentation

The usage of this cli is very simple. It boasts two commands:

  • The fcd command
  • The fcd-config command

fcd

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

fcd-config

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 to node_modules,Trash,Library
  • ignoreDotFolders: Whether to ignore .folders like .git or .bin. Defaults to true
  • addNewlineToCopy: Whether to add a newline to the copied cd command. When set to true, the copied cd command will automatically run when pasted and vice-versa. Defaults to true

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.

    setting completely overwrites the previous configuration. If you meant to add a value to, for example, ignoredFolders use the add 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 become false, 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 values

    Example:

    $ 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

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

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.

  1. Discuss the contribution
  2. Fork the Project
  3. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  4. Commit your Changes (git commit -m 'Add some AmazingFeature')
  5. Push to the Branch (git push origin feature/AmazingFeature)
  6. Open a Pull Request

More info is available in the CONTRIBUTING file

License

Distributed under the GNU GPL-3.0 License. See LICENSE for more information.

Contact

Siddharth Shyniben - [email protected]

Project Link: https://github.com/SiddharthShyniben/fcd