GithubHelp home page GithubHelp logo

cutecd's Introduction

Cute CD

versions of GNU cd written on Golang and Python

Idea

I want to do something more than standard cd, but solve similar problems. Sometimes, working in a terminal, it's very annoying to prescribe long paths to folders, especially if you do not remember them exactly. Recursive search can save time. I do NOT replace the cd, but try to provide an instrument that saves my time and nerves.

What is already done

At the moment, single-threaded recursive search is implemented, and you can

  • select the start point of search
  • search for a full name match, or by a pattern (in GO pattern must match the end of name)
  • choice of several suitable folders (only in GO version)
  • case-insensitive/case-sensitive matching modes
  • chose one from multiplie found folders, or chdir to first found
  • search all directories, or exclude hidden (only in Python version)
  • set search depth limit

Known bugs

  • Zsh drops out with segfault if use GO version

How to use

Python version

Synopsis
ccd [search name or pattern] [keys] (in any order)

Keys
-d set start search point. Default -- $HOME value
-f make chdir to the first found directory, will be no choice
-p interpretate [name] as a regular search pattern. Default -- [name] must coincide with dir name.
-l case unsensitive search. Default -- case sensitive
-a search in hidden directories. Default -- dont search in hidden
-r set search depth limit. Do not set big values. Default -- 100
-c try use specefied config file

Config file
CuteCD also uses configuration file. It will be created at first use as $HOME/.config/ccd.conf Config options:

  • [Default] -- section with parameters that can be overwritten by flags use
    • start_point -- default root of searching (flag -d/second request)
    • search_by_pattern -- interprete request string as regular pattern, not as dir name (flag -p)
    • include_hidden_files -- search in/for hidden dirs (flag -a)
    • search_til_first -- make chdir to the first found directory (flag -f)
    • max_depth -- maximum search depth (flag -r)
    • case_sensitive -- case sensitive search (flag -l)
  • [Rules] -- rules of search for adjusting search performance and decrease search time and result list
    • excluded_dirs -- dont search in these dirs. Syntax fullpath1:fullpath2...
    • exclude_pattern -- dont search in dirs with names matching pattern. Standart Python re syntax.

GO version (DEPRECATED and REMOVED)

Synopsis
ccd [DIR_NAME] [START_DIR] [KEYS]
in any order

Keys
-p match dirs by name pattern, not by name
-c for case-sensitive matching. By default search is NOT case-sensitive
-y will abort program and make cd to FIRST found directory
-n will find all matched dirs (by default)
-r you can set recursion limit. Please, dont set values greater then 1000. Default - 100
-s you can set start directory. By default - your $HOME directory
(WILL BE DEPRECATED SOON BECAUSE OF USELESS)
(YOU MAY NOT USE THE KEY TO SET START DIR. JUST SET IT AFTER [DIR_NAME] IN THE SAME WAY)
-d output debug message contains search parameters

Examples

  • ccd Documents
    • will find dirs with names matching 'Documents' in your $HOME and give you choice where to cd
  • ccd uments -p
    • will find dirs with names, matching pattern '^.*uments$' in your $HOME and give you choise where to cd
  • ccd uments -p -y
    • will find dirs with names, matching pattern '^.*uments$' in your $HOME and make cd to first found dir.
  • ccd share -s /
    • will find dirs with names matching 'share' in / directory and give you choice where to cd
  • ccd share -p /
    • will find dirs with names matching '^.*share$' in / directory and give you choice where to cd
      Short demo

cutecd's People

Contributors

yiffyrusdev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.