evanthegrayt / cdc Goto Github PK
View Code? Open in Web Editor NEW☣️ Shell plugin for zsh/bash that allows you to cd to subdirectories of user-defined directories from anywhere, without editing CDPATH.
License: MIT License
☣️ Shell plugin for zsh/bash that allows you to cd to subdirectories of user-defined directories from anywhere, without editing CDPATH.
License: MIT License
Just an idea as of right now... but you don't always get to name the repository (even though you can clone it as whatever directory name you'd like), so maybe people would want a way to alias directory names via cdc
. Just make sure both show up in tab-completion.
\e
for colors doesn't work on all platforms. Change the default colors and examples to use \033
.
I'd like to silence messages if the directory doesn't exist, but I don't think this should be the default behavior, so maybe add an available option in the .cdcrc
file.
Consider adding -P
that will purge the last, or optionally a count, elements from the history stack without changing the current working directory.
Add completion for bash that performs the same as it does with zsh.
We need a configuration variable to and runtime options to find repositories that start with a dot. NOTE that cdc .whatever
will always work, it's just that they currently don't show up in tab-completion.
Line 570
for fulldir in "$dir"/*/; do
Should become something like
if $ALLOW_DOTFILES; then
dirlist = {,.}$dir/*/
else
dirlist = "$dir"/*/
fi
for fulldir in "$dirlist"; do
I want to be able to cdc .vim
, but my .vim
directory is in my home directory, which I don't want added to CDC_DIRS
.
I'm thinking there should be another array that can be checked for definitions of specific directories. The trick will be getting tab completion to work as expected.
Update README.md to include installation instructions for vanilla zsh/bash.
There's currently no way to cdc
to a directory that is in the CDC_IGNORE
array. Add -a
option (standing for "allow") that will make cdc
ignore the setting.
Or... maybe get crazy with it and add -a
to ignore the setting, and ALSO add -i [dir]
to add [dir]
to the CDC_IGNORE
array. This would have to be cached somewhere. THEN we'd need a -I
option to remove [dir]
from the cache. Maybe even -c
to just clear the whole cache?!
Nah... this is too crazy. Or is it...? 🤔
Currently, the only thing in .cdcrc
that can't be overridden with an option is enabling/disabling colored output.
Tab completion should respect the -r
and -R
options, not just $CDC_REPOS_ONLY
. No idea how to accomplish this as of right now, so any help would be appreciated.
Create a way to ignore directories that match string when tab completing
Figure out how to be able to tab down a directory tree
Add an option (or maybe add to the -D
flag) for printing the current environment options.
CDC_DIRS
CDC_IGNORE
CDC_AUTO_PUSH
CDC_REPOS_ONLY
CDC_COLOR
CDC_SUCCESS_COLOR
CDC_WARNING_COLOR
CDC_ERROR_COLOR
If I'm in a directory, and it's not currently on the stack, there's no way to add it unless you use cdc DIR
. It'd be nice if you could do cdc .
and have it push to the stack.
Example:
cd ~/repo
cd a/nested/subdir
# Now I want to go back to the root of `repo`, but can't use `cdc -n`
# SOLUTION
cd ~/repo # oh crap, I want this on the history stack
cdc .
Also, and I'm not sure about this one... but it'd be cool to add cdc ..
, and it would traverse up the directory tree until it found a file in the CDC_REPO_MARKERS
, changed to that directory, and added it to the stack (if requested).
Add a flag lists the available directories. We already have tab-completion, but the user should have a way to get this functionality with a flag.
Every time I want to make a change, I have to re-figure out exactly how it works. Add comments to make this easier.
CDC_QUIETER=true
, suppress ALL warningsCDC_QUIETER=true
, also set CDC_QUIET=true
-i
should list directories in the ignore array.
The error messages are annoying. I'll add a flag for entering debug mode, and that's the only time the warning will print.
I finished #23 and was wanted to release it, but I was too tired to comment it.
\e
for colors doesn't work on all platforms. Change the default colors and examples to use \033
.
Something like cdc -w [DIRECTORY]
to not change to the directory, but display its location.
We want it to stay in the correct order, so use uniq
instead of sort -u
. Here's how.
x=(name name notes notes notes)
printf "%s\n" "${x[@]}" | uniq
#=> name notes
Currently, every time you cdc
to a directory, it adds it to the history stack. We could take this further, and disable the "auto-pushd" feature, but have cdc -u
(flag can be whatever) add the directory to the stack. Add a configuration variable like CDC_AUTO_PUSH=true
that the user can set in ~/.cdcrc
Write a man
page for the plugin.
Add a -g
option that goes through every repo and prints git status
A lot more could be done. Some ideas include
cdc /
for, when in a repo, change to the root of the repo.
cdc -
change to the last repocdc pop
could change to the last repo in the stack, similar to popd
.
cdc
call is madePR: #14
Because of the way getopts works, if you call -D
after one of the stack modifying options, debug more won't be true.
CDC_REPOS_ONLY
(or something similar) which will only consider repositories to cd
to..git
) before adding it to the list of potential directoriesCDC_REPO_MARKERS=(.git .git/ Rakefile Makefile .hg/ .bzr/ .svn/)
Add better completion for zsh. Use _arguments
and give descriptions of flags.
Add some color to output. Nothing crazy, but maybe something to make DEBUG
statements stand out.
Make it like vb
so the user can customize the colors in ~/.cdcrc
not sure what's going on but the autocompletion does not work for me unless I manually run _cdc_repo_list
, which has resulted in me adding
# workaround for broken cdc autoload
source ~/.antigen/bundles/evanthegrayt/cdc/_cdc.zsh >/dev/null 2>&1
_cdc_repo_list >/dev/null; cd
to my .zshrc after antigen apply
. any ideas why that might be? And even this workaround doesn't seem to work all the time, and I can't figure out why.
super helpful otherwise though, thanks for writing it!
Let the user set colors like
CDC_SUCCESS_COLOR='bold green'
If the user wants to get specific, they could still use the escape sequences.
Plugin needs a refactor.
lib/cdc_functions.sh
or similar to pull out verbose code into functions.Assuming the following:
CDC_DIRS=(dir1 dir2)
cdc repo
and the following directories both exist
dir1/repo
dir2/repo
We need to ask the user which one to cd
to. Currently, it will just cd
to the first instance it finds.
We should gather existing directories in an array, and if the array's size is > 1
, prompt the user. Consider using the select
command.
We need an option to reload the .cdcrc
file. Or maybe it should just re-load every time the function is called? Might increase runtime, although it's just setting like 5 variables. More consideration is needed.
PR #46
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.