oh-my-fish / theme-agnoster

MIT License
95 stars 64 forks source link

Errors using agnoster if svn isn't present #3

Closed MarkHerhold closed 9 years ago

MarkHerhold commented 9 years ago

It appears that agnoster is looking to see if svn is installed but is causing an error in the process. Perhaps which svn might be a better match for this check?

System: Ubuntu 14.04 x64

/home/mark/.oh-my-fish/themes/agnoster/fish_prompt.fish (line 129):   if command svn ls . >/dev/null 2>&1
                                                                                 ^
in function “prompt_svn”,
    called on line 180 of file “/home/mark/.oh-my-fish/themes/agnoster/fish_prompt.fish”,

in function “fish_prompt”,
    called on standard input,

in command substitution
    called on standard input,

The program 'svn' is currently not installed. You can install it by typing:
sudo apt-get install subversion

I fixed the issue by installing subversion sudo apt-get install subversion but I feel like users shouldn't have to do that.

bpinto commented 9 years ago

Agreed. Could you submit a PR?

MarkHerhold commented 9 years ago

@bpinto Possibly. I'll have to request approval.

FabioAntunes commented 9 years ago

I fixed this issue doing type svn, here's the function changed:

function prompt_svn -d "Display the current svn state"
  set -l ref
  if type svn >/dev/null 2>&1
    if command svn ls . >/dev/null 2>&1
      set branch (svn_get_branch)
      set branch_symbol \uE0A0
      set revision (svn_get_revision)
      prompt_segment green black "$branch_symbol $branch:$revision"
    end
  end
end
bpinto commented 9 years ago

@FabioAntunes Nice! Could you merge both if scenarios with an and?

FabioAntunes commented 9 years ago

@bpinto sure, here's the merge function:

function prompt_svn -d "Display the current svn state"
  set -l ref
  if type svn >/dev/null 2>&1; and command svn ls . >/dev/null 2>&1
    set branch (svn_get_branch)
    set branch_symbol \uE0A0
    set revision (svn_get_revision)
    prompt_segment green black "$branch_symbol $branch:$revision"
  end
end
bpinto commented 9 years ago

Hey, would you submit as a PR? Sorry for the trouble!

sn0cr commented 9 years ago

I'm sorry, but this PR creates the bug documented in PR #5 - it shows the svn branch symbol at any time (on OS X).