jichu4n / fish-command-timer

Fish shell extension for printing execution time for each command.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fish: Unknown command 'then'

danielb2 opened this issue · comments

[~/.c/f/functions]$ source fish_command_timer.fish
fish: Unknown command 'then'
fish_command_timer.fish (line 92): else if type perl > /dev/null ^ /dev/null; then
                                                                              ^
from sourcing file fish_command_timer.fish
    called on standard input

Can't find string terminator '"' anywhere before EOF at -e line 1.
(standard_in) 2: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
test: Missing argument at index 2
test: Missing argument at index 2
test: Missing argument at index 2
: Invalid argument
(standard_in) 1: parse error
                                                                              [  | Dec 31 04:00PM ]
[daniel@nero]--(08:17:54)

The string terminator errors are different from the error about then which was an easy fix

fish, version 2.3.0
Darwin nero.local 14.5.0 Darwin Kernel Version 14.5.0

else if type perl > /dev/null ^ /dev/null; and
  function fish_command_timer_get_ts
    perl -MTime::HiRes -e 'printf("%d",Time::HiRes::time()*1000000000)'
  end
  function fish_command_timer_print_time
    date -r "$argv[1]" +"$fish_command_timer_time_format"
  end
else

changing to this fixed several errors and made it work, but still get errors during load:

[~/.c/f/functions]$ source fish_command_timer.fish
(standard_in) 2: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
test: Missing argument at index 2
test: Missing argument at index 2
test: Missing argument at index 2
: Invalid argument