Fish completions, function with same name #3158

Closed
FabioAntunes opened this Issue Jun 20, 2016 · 4 comments

Projects

None yet

2 participants

@FabioAntunes
FabioAntunes commented Jun 20, 2016 edited

I'm having a hard time with completions and a function I have created.

function npm -d "node package manager"
  __nvm_run "npm" $argv
end

So this function basically calls __nvm_run checks if nvm has already sourced node, if not sources it and then runs npm, if node is already sourced then it just runs npm.

That function creates this issue #3152

If I change the function to this:

function npm -d "node package manager" -c npm -w npm
   echo "This won't run"
  __nvm_run "npm" $argv
end

The completions works fine, but the function it's not called anymore.

any help?


For 2.3.1 release:

  • Update release notes
@faho
Member
faho commented Jun 20, 2016

The latter is a broken function definition - there's no "-c" option to "function", so the definition is invalid. That it doesn't print an error is #2827 (though it appears it also applies to short options, despite what the title says).

The rest is #3152, so I'll close this as a duplicate of that, and it seems that the blame lies with the __nvm_run function.

@faho faho closed this Jun 20, 2016
@faho faho added the duplicate label Jun 20, 2016
@FabioAntunes

I'm sorry but I don't think there's something wrong with my function, if you create a function like this:

function npm -d "node package manager" -w npm
  command npm $argv
end

You wil get the same result from #3152

@FabioAntunes
FabioAntunes commented Jun 20, 2016 edited

In fact if I create a function with a different name let's say npm2, everything works fine:

function npm2 -d "node package manager" -w npm
  __nvm_run "npm" $argv
end
@FabioAntunes

@faho I submited a pull request that fixes the issue with completions

@faho faho reopened this Jun 21, 2016
@faho faho removed the duplicate label Jun 21, 2016
@faho faho added a commit that closed this issue Jun 21, 2016
@faho faho npm completions: Call command npm
npm is often wrapped by a function.

Fixes #3158.
3a0d417
@faho faho closed this in 3a0d417 Jun 21, 2016
@faho faho added this to the 2.3.1 milestone Jun 21, 2016
@faho faho added a commit that referenced this issue Jun 21, 2016
@faho faho npm completions: Call command npm
npm is often wrapped by a function.

Fixes #3158.

(cherry picked from commit 3a0d417)
bc8ec46
@faho faho added a commit that referenced this issue Jun 21, 2016
@faho faho npm completions: Check command npm existence
Really fixes #3158 and #3152.
10661bb
@faho faho added a commit that referenced this issue Jun 21, 2016
@faho faho npm completions: Check command npm existence
Really fixes #3158 and #3152.

(cherry picked from commit 10661bb)
8070cd8
@floam floam added a commit to floam/fish-shell that referenced this issue Jul 4, 2016
@faho @floam faho + floam npm completions: Call command npm
npm is often wrapped by a function.

Fixes #3158.
63e0694
@floam floam added a commit to floam/fish-shell that referenced this issue Jul 4, 2016
@faho @floam faho + floam npm completions: Check command npm existence
Really fixes #3158 and #3152.
0109a3e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment