jira-cli icon indicating copy to clipboard operation
jira-cli copied to clipboard

fish completion doesn't work when jira doesn't have TOKEN set

Open jficz opened this issue 11 months ago • 0 comments

Describe the bug In fish jira completion functions don't work when Jira token env var is not set:

jira __complete ''
The tool needs a Jira API token to function.
...snip...

Completion debug log:

========= checking if order preservation is required ==========
Starting __jira_perform_completion_once
Starting __jira_perform_completion
args: jira
last arg: ''
Calling JIRA_ACTIVE_HELP=0 jira __complete  ''
Comps: 
DirectiveLine: 
flagPrefix: 
No completions, probably due to a failure
Error determining if order preservation is required

========= checking if order preservation is required ==========
Starting __jira_perform_completion_once
Starting __jira_perform_completion
args: jira
last arg: ''
Calling JIRA_ACTIVE_HELP=0 jira __complete  ''
Comps: 
DirectiveLine: 
flagPrefix: 
No completions, probably due to a failure
Error determining if order preservation is required

========= starting completion logic ==========
Starting __jira_perform_completion_once
Starting __jira_perform_completion
args: jira
last arg: ''
Calling JIRA_ACTIVE_HELP=0 jira __complete  ''
Comps: 
DirectiveLine: 
flagPrefix: 
No completions, probably due to a failure
Completion results: 
No completion, probably due to a failure

========= clearing previously set __jira_perform_completion_once_result variable ==========
Successfully erased the variable __jira_perform_completion_once_result

Please provide following details

  1. JiraCLI Version:

(Version="1.5.2", GitCommit="refs/tags/v1.5.2", CommitDate="1970-01-01T00:00:00+00:00", GoVersion="go1.23.5", Compiler="gc", Platform="linux/amd64") (ignore CommitDate, it's a NixOS thing)

  1. Are you using Jira cloud or on-premise jira server?
-----------

Version:         1001.0.0-SNAPSHOT
Build Number:    100278
Deployment Type: Cloud
Default Locale:  en_US
  1. What operating system are you using? Also mention version. NixOS 24.11

  2. What terminal are you using? Also mention version.

Kitty 0.37.0

To Reproduce

Steps to reproduce the behavior: 0. make sure JIRA_API_TOKEN is not set

  1. jira completion fish | source
  2. jira <tab>
  3. list of files appears instead of options

Expected behavior Completion should imho work even if JIRA_API_TOKEN is set.

Additional context The problem is likely caused by the test run in the completion code where, at some point jira __completion '' is called in the __jira_perform_completion function (I'm not sure where this code is coming from exactly). Unfortunately the output of the command isn't completion but the "missing token" error above. I believe that __completion and related parts should not be in any way dependent on the application setup.

This also affects other completions (zsh didn't work for me either but bash did work. Didn't look into the details why yet).

jficz avatar Feb 04 '25 11:02 jficz