go-jira / jira

simple jira command line client in Go
Apache License 2.0
2.68k stars 326 forks source link

'list' file confusion with subcommand #167

Open colton22 opened 6 years ago

colton22 commented 6 years ago

The script seems to get confused when detecting a file which name matches a subcommand... Forgive me for not being able to show a real ticket title, I just choose -a jsmith to prevent our projects from being shown.

09:58:29 manjarouser:~ > file list
list: cannot open `list' (No such file or directory)
09:58:30 manjarouser:~ > gojira list -a criffel |wc
      8      82     596
09:58:31 manjarouser:~ > 
09:58:33 manjarouser:~ > gojira list -a jsmith

09:58:36 manjarouser:~ > for i in {1..20};do echo line$i >> list;done
09:58:53 manjarouser:~ > file list
list: ASCII text
09:58:59 manjarouser:~ > gojira list -a jsmith
line1
line2
line3
line4
line5
line6
line7
line8
line9
line10
line11
line12
line13
line14
line15
line16
line17
line18
line19
line20
09:59:07 manjarouser:~ > 
colton22 commented 6 years ago

This behavior also happens when using command view

coryb commented 6 years ago

Thanks I was able to reproduce. It was supposed to default to .jira.d/templates/<command> so not sure why yet it is also allowing ./<command> as well for the template source. I will try to resolve this.

colton22 commented 6 years ago

ref #184

dobbymoodge commented 4 years ago

This looks like the behavior lives in the figtree findParentPaths function that eventually gets called from getTemplate in templates.go.

ACTUALLY nevermind, findClosestParentPath in util.go picks the path from the end of the array, which AFAICT should be correct