Code Monkey home page Code Monkey logo

cdc's Introduction

cdc's People

Contributors

evanthegrayt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cdc's Issues

Option for aliasing directories

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.

Add option to quiet messages

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.

Purge option

Consider adding -P that will purge the last, or optionally a count, elements from the history stack without changing the current working directory.

Allow hidden directories to be found

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

Add specific directories not in CDC_DIRS

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.

Add "allow ignored" option

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...? 🤔

Tab completion to consider flags

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.

Add environment printing

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

Add way to push current directory onto the stack

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).

"List" option

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.

Add comments to the code

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 option

  • If the user sets CDC_QUIETER=true, suppress ALL warnings
  • If CDC_QUIETER=true, also set CDC_QUIET=true
  • Update readme

Update default colors

\e for colors doesn't work on all platforms. Change the default colors and examples to use \033.

Add "which" option

Something like cdc -w [DIRECTORY] to not change to the directory, but display its location.

Option to make stack elements unique

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

Ability to disable "auto-pushd" and add flag for "pushd"

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

Tests

After #40, we should have the big function split up more. At that point we should add some bats tests.

Add more navigation options

A lot more could be done. Some ideas include

  • cdc / for, when in a repo, change to the root of the repo.
    • Would need an array of known roots, such as in vim-rooter
  • cdc - change to the last repo
  • cdc pop could change to the last repo in the stack, similar to popd.
    • Would need an array of repos to push to when a successful cdc call is made

PR: #14

Add way to force repositories only

  • Add variable CDC_REPOS_ONLY (or something similar) which will only consider repositories to cd to.
  • Check for repo markers (.git) before adding it to the list of potential directories
  • Have an array containing known markers that the user can change if needed.
    • CDC_REPO_MARKERS=(.git .git/ Rakefile Makefile .hg/ .bzr/ .svn/)

Better completion

Add better completion for zsh. Use _arguments and give descriptions of flags.

Add colored output

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

zsh tab completion autoload fails

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!

Human readable colors

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.

Cleanup

Plugin needs a refactor.

  • We're already using helper functions, so try to split more out.
  • Consider making a lib/cdc_functions.sh or similar to pull out verbose code into functions.
  • Add comments to new code missing them.

Add handling of multiple repos with same name in different locations

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.

option to re-load cdcrc

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

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.