versions of GNU cd written on Golang and Python
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.
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
- Zsh drops out with segfault if use GO 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.
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
- 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
- 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.
- 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
- 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
- will find dirs with names matching '^.*share$' in / directory and give you choice where to cd