Call another function in the fish shell

I got this great answer on how to convert a zsh function to a fish function. Now I have another question. How to call this function from another function by passing an argument?

I tried this:

function ogf
  echo "Cloning, your editor will open when clone has completed..."
  source (env TARGET_DIRECTORY=~/students EDITOR=$EDITOR clone_git_file -ts $argv[1] | psub)
end

function wogf
  env EDITOR=webstorm ogf "$argv[1]"
end

but I get "env: ogf: There is no such file or directory".

The goal is to change the environment variable EDITORfor this one run and then call ogf.

+4
source share
1 answer

env . ; , , bash - . , , --no-scope-shadowing, set -l :

function ogf --no-scope-shadowing
  echo "Cloning, your editor will open when clone has completed..."
  source (env TARGET_DIRECTORY=~/students EDITOR=$EDITOR clone_git_file -ts $argv[1] | psub)
end

function wogf
  set -l EDITOR webstorm
  ogf $argv
end
+3

Source: https://habr.com/ru/post/1668986/


All Articles