Fisher: Conflict with pre-existing function

Created on 11 Mar 2016  ·  10Comments  ·  Source: jorgebucaran/fisher

Hi. I have a pre-existing function that I load from an init.fish

config.fish

#// path to Fisherman install
set fisher_home ~/.local/share/fisherman

#// Fisherman configuration path
set fisher_config ~/.config/fisherman

#// load Fisherman configuration
source $fisher_home/config.fish

#// path to custom configuration
set custom_home ~/.config/fish

#// load custom configuration
source $custom_home/init.fish

init.fish

#// custom sources
source $custom_home/custom/export.fish
source $custom_home/custom/aliases.fish
source $custom_home/custom/utils.fish

The function (from aliases.fish):

function cd --description 'Auto ls for each cd'
  if [ -n $argv[1] ]
    builtin cd $argv[1]
    and ls -ahlF
  else
    builtin cd ~
    and ls -ahlF
  end
end

And when this function is loaded, fisher is no longer to able to install plugins, z for instance. Here is what the output looks like (with the function; I cancel at a point so it doesn't continue to output obviously wrong info):

michael@esquivel [/Users/michael] $ fisher install z
▸ Installing drwxr-xr-x  12 michael  staff   408B Mar 10 15:23 ./
fatal: repository 'total' does not exist
▸ Installing drwxr-xr-x  13 michael  staff   442B Mar 10 15:23 .git/
fatal: repository 'drwxr-xr-x' does not exist
▸ Installing -rw-r--r--   1 michael  staff   1.0K Mar 10 15:23 LICENSE
error: unknown switch `r'
usage: git clone [<options>] [--] <repo> [<dir>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --progress            force progress reporting
    -n, --no-checkout     don't create a checkout
    --bare                create a bare repository
    --mirror              create a mirror repository (implies bare)
    -l, --local           to clone from a local repository
    --no-hardlinks        don't use local hardlinks, always copy
    -s, --shared          setup as shared repository
    --recursive           initialize submodules in the clone
    --recurse-submodules  initialize submodules in the clone
    --template <template-directory>
                          directory from which templates will be used
    --reference <repo>    reference repository
    --dissociate          use --reference only while cloning
    -o, --origin <name>   use <name> instead of 'origin' to track upstream
    -b, --branch <branch>
                          checkout <branch> instead of the remote's HEAD
    -u, --upload-pack <path>
                          path to git-upload-pack on the remote
    --depth <depth>       create a shallow clone of that depth
    --single-branch       clone only one branch, HEAD or --branch
    --separate-git-dir <gitdir>
                          separate git dir from working tree
    -c, --config <key=value>
                          set config inside the new repository

▸ Installing -rw-r--r--   1 michael  staff   282B Mar 10 15:23 THANKS.md
error: unknown switch `r'
usage: git clone [<options>] [--] <repo> [<dir>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --progress            force progress reporting
    -n, --no-checkout     don't create a checkout
    --bare                create a bare repository
    --mirror              create a mirror repository (implies bare)
    -l, --local           to clone from a local repository
    --no-hardlinks        don't use local hardlinks, always copy
    -s, --shared          setup as shared repository
    --recursive           initialize submodules in the clone
    --recurse-submodules  initialize submodules in the clone
    --template <template-directory>
                          directory from which templates will be used
    --reference <repo>    reference repository
    --dissociate          use --reference only while cloning
    -o, --origin <name>   use <name> instead of 'origin' to track upstream
    -b, --branch <branch>
                          checkout <branch> instead of the remote's HEAD
    -u, --upload-pack <path>
                          path to git-upload-pack on the remote
    --depth <depth>       create a shallow clone of that depth
    --single-branch       clone only one branch, HEAD or --branch
    --separate-git-dir <gitdir>
                          separate git dir from working tree
    -c, --config <key=value>
                          set config inside the new repository

▸ Installing drwxr-xr-x   3 michael  staff   102B Mar 10 15:23 conf.d/
fatal: repository 'drwxr-xr-x' does not exist
▸ Installing drwxr-xr-x   3 michael  staff   102B Mar 10 15:23 man/
fatal: repository 'drwxr-xr-x' does not exist
▸ Installing total 2288
fatal: repository 'drwxr-xr-x' does not exist
▸ Installing drwxr-xr-x     5 root     admin   170B Dec 21 14:43 ../
fatal: repository 'drwxr-xr-x+' does not exist
▸ Installing -rw-r--r--@    1 michael  staff    26K Mar 11 11:35 .DS_Store
^C⏎

As you can see, it attempts to install a directory listing instead of z. I would prefer not to lose or relocate my function since it is under version control in a specific location in my filesystem. What is the resolve to this issue? I'm still experimenting with how I want my files to sit, so any insight is appreciated. Thank you.

bug

All 10 comments

Fisherman should not be calling cd, but rather command cd. I think we missed a few from https://github.com/fisherman/fisherman/issues/79.

So, the function you have a custom alias for is cd right?

That's correct, the custom cd alias posted above.

I'll patch this and send it your way later today! Thanks for calling this one out.

No problem, thanks for your project

@michaelperrygoodman I am sorry it took me 18 days to get back at you, but could you list what other functions besides cd you are defining?

I am almost ready to release 1.4.0 :smile:

@bucaran No problem, I have not encountered any other conflicts so far aside from that cd one, but my config setup is here if you want to check it out and see if you see anything that might cause an issue that I'm unaware of.

https://github.com/michaelperrygoodman/dotfiles/tree/master/fish

@michaelperrygoodman Alright, I tried patching as many as I could find. 1.4.0 is also up btw with concurrent installs as well as updates.

Cheers!

Hey, this is actually still breaking for me in a similar but different way. I can't paste everything because it's exposing directories and things I don't want public, but it seems to be dumping my cd output. PM me if you want a full paste.

@michaelperrygoodman Alright, let's find this little bug, send me the full paste to my email, it's right there on my profile page.

EDIT: If you are on the slack channel, we can chat there too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

keyolk picture keyolk  ·  9Comments

plgruener picture plgruener  ·  5Comments

x7a picture x7a  ·  3Comments

IlanCosman picture IlanCosman  ·  7Comments

elwan picture elwan  ·  5Comments