Giter VIP home page Giter VIP logo

smartcd's People

Contributors

codesofrishi avatar

Stargazers

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

Watchers

 avatar

smartcd's Issues

Feature request: Brew support

Could you consider adding this to the "brew" package manager? I don't know what work that would entail for you, but it could be appreciated if possible.
I use Brew on the Mac and on a couple of Linux servers.

Thanks

Breaks zsh tab completion

Without the plugin, if I type cd and press TAB I get a list of only directories.

With the plugin, both files and directories are listed.

.zshrc config required:

autoload -Uz compinit && compinit

[BUG] Variable namespace pollution

Are you using the latest version?
4.0.0

The issue is with the following feature(s):

  • Traversal to root of a git repository.
  • Search & traverse w.r.t. to a base directory.
  • Search & traverse recently visited directories.
  • Sub-directory search & traversal.
  • Parent-directory search & traversal.
  • Piping.
  • Cleaning of log file.
  • Installation.
  • Dependencies/Requirements.
  • Configurations.
  • Documentation.
  • Other(s)

Issue observed in the following shell(s):

  • Bash
  • Zsh

Describe the bug
I get unwanted and unneeded extra variables after sourcing this.

Eg _feats. (which may be better named singular anyway).

To Reproduce
Steps to reproduce the behaviour:

  1. ( set -o posix ; set ) > before
  2. Source plugin
  3. ( set -o posix ; set ) > after
  4. diff before after

Expected behaviour
Minimum set of required variables are added, and only exported if needed

[BUG] 'Permission denied' error output when using `find` command.

Are you using the latest version?
...

The issue is with the following feature(s):

  • Traversal to root of a git repository.
  • Search & traverse recently visited directories.
  • Sub-directory search & traversal.
  • Parent-directory search & traversal.
  • Piping.
  • Cleaning of log file.
  • #17
  • Dependencies/Requirements.
  • Configurations.
  • Documentation.
  • Other(s)

Issue observed in the following shell(s):

  • Bash
  • Zsh

Describe the bug
find command throws 'Permission denied' error message(s) whenever it searches and finds any directory with insufficient permissions.

To Reproduce
NA

Expected behaviour
Remove/skip/exclude 'Permission denied' error messages coming from find command.

Screenshots
NA

Additional context
NA

Allow setting search root

Often in a deep directory, I want to be able to cd and search to anywhere below $HOME.

I'd like to be able to do:

alias hcd='f() { SMARTCD_ROOT=$HOME; cd "$@"; unset SMARTCD_HOME; };f'

Would you consider a SMARTCD_ROOT variable from which the listing is generated? I'd suggest a subshell for the generation to allow for user ^C or permission denied on the target directory.

[BUG] `whereis -b` not supported on macOS

Issue observed in the following shell(s):

  • Bash
  • Zsh

Describe the bug
Upon shell startup:

whereis: illegal option -- b
usage: whereis program [...]
Can't use SmartCd: fzf not found !

I suggest you do:

is_cmd () {
        command -v "$1" >&/dev/null
}

and then:

	if is_cmd fdfind; then

Expected behaviour
No error

Add zinit installation instructions

Zinit

zinit ice wait  # For faster prompt loading
zinit snippet 'https://raw.githubusercontent.com/CodesOfRishi/smartcd/main/smartcd.sh'

For copy paste:

### [Zinit](https://github.com/zdharma-continuum/zinit)

Fix shellcheck error / warnings

Please run shellcheck against this -- there are many warnings and an error:

 validate_parameters $@ ${piped_value}

Should be: "$@".

If possible, avoid using `hash` as it hashes binary's path

Are you using the latest version?
v4.0.0

The issue is with the following feature(s):

  • Traversal to root of a git repository.
  • Search & traverse w.r.t. to a base directory.
  • Search & traverse recently visited directories.
  • Sub-directory search & traversal.
  • Parent-directory search & traversal.
  • Piping.
  • Cleaning of log file.
  • Installation.
  • Dependencies/Requirements.
  • Configurations.
  • Documentation.
  • Other(s)

Issue observed in the following shell(s):

  • Bash
  • Zsh

Describe the bug
SmartCd is using hash command to validate whether an executable exist or not.
hash command hashes the searched path for faster lookup next time when it's used again. Hashing is really not necessary here.

Additional context
Possible alternatives:

  • whence command in zsh. (run man zshbuiltins & search whence)
  • type command in bash. (run help type)

Possible solution:

path_search() {
	local _executable=$1
	if ps -p $$ | grep -i --quiet 'zsh$'; then
		whence -p "${_executable}" &> /dev/null
	elif ps -p $$ | grep -i --quiet 'bash$'; then
		type -P "${_executable}" &> /dev/null
	else 
		printf '%s\n' "Shell doesn't seems to be either Base or Zsh" 1>&2
		return 1
	fi
}

Changing to permission denied directory

% mkdir -m000 noperms     

Standard behaviour:

% builtin cd noperms 
cd: permission denied: noperms
% 

With SmartCd, I get a directory search.

% cd noperms 
No directory found or selected!

If the specified diretory exists, can it fail just like the builtin cd?

AUR package

Do you have plans to package it for the AUR?

I can offer 2 options:

  • I can help you package it or package it for you and provide a rundown of how to put it on AUR.
  • I can put it on AUR and maintain it myself.

Let me know if you want either or none.

Cheers

There's already a smartcd that patches cd

There is already a project using the name smartcd to patch the shell cd command. It exists at https://github.com/cxreg/smartcd.

I don't really want to start a fight over naming or anything like that. I suggest that both projects provide a short statement saying something like "if you're looking for OTHER SMARTCD that does THE OTHER THING you can find it at THE OTHER SMARTCD PROJECT URL".

I have a commit bit on the other smartcd, and can update the readme accordingly.

Error on startup

whereis: illegal option -- b
usage: whereis program [...]
whereis: illegal option -- b
usage: whereis program [...]
Can't use SmartCd: fzf not found !
whereis: illegal option -- b
usage: whereis program [...]
Can't use SmartCd: fd not found !

[FEAT] Remove unnecessary subshells

Is your feature request related to a problem? Please describe.
Remove unnecessary calls to awk

Describe the solution you'd like

% col_n () {
    [[ -n $ZSH_VERSION ]] && setopt local_options sh_word_split
    local col=$1
    local IFS=$' \t'
    while read -r line; do
        set $line  # Spilt by IFS and set into $1, $2, ...
        printf "%s\n" "${@:$col:1}"
    done;
}
% echo "one two three" | col_n 2
two

[BUG] To many arguments

Are you using the latest version?
Yes. v3.3.0

The issue is with the following feature(s):

  • Traversal to root of a git repository.
  • Search & traverse w.r.t. to a base directory.
  • Search & traverse recently visited directories.
  • Sub-directory search & traversal.
  • Parent-directory search & traversal.
  • Piping.
  • Cleaning of log file.
  • Installation.
  • Dependencies/Requirements.
  • Configurations.
  • Documentation.
  • Other(s)

Issue observed in the following shell(s):

  • Bash
  • Zsh

Describe the bug
In bash, cd with multiple string arguments is throwing too many arguments error.

To Reproduce

  1. cd ~ (traverse to home directory)
  2. Run cd \!git fzf

Expected behaviour
Should bring fzf list of sub-directories with provided string arguments as query for the fzf.

Screenshots
NA

Additional context
High probability that bug occurred from 9698c36.

Allow '' or empty first argument to trigger

I find it much easier to type '' than --.

Also, -- has a valid meaning eg, cd -P -e -- -P.

In this example, P and e are arguments to cd (please pass these through!) whereas the -- says that what follows, ie -P is not an argument to cd itself, but rather the directory to change to. (Useful if you have directory names starting with a -)

Cleaning of log without user's consent!

Piping an empty string or an empty file to cd having --clean option, cleans the log file without the user's consent.
For example,

echo | cd --clean
# OR
touch file1 # creating an empty file
cat file1 | cd --clean

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.