Page MenuHomePhabricator

Indicate when long envvars are cutoff when listing
Closed, ResolvedPublic

Description

Given that

Some of my envvars can be long (e.g. paths) and currently toolforge envvars list cuts off the display of long values at 50 characters

I want to

Have some indication in the list that a long value is being cut off—such as via ... or the like—if the full value cannot be shown. I know toolforge envvars show name will give the full value, but when viewing the list, with no indication otherwise, it makes it look like e.g. a long path has been entered incorrectly.

Details

TitleReferenceAuthorSource BranchDest Branch
list: avoid all envvars getting '...' appendedrepos/cloud/toolforge/envvars-cli!20sstefanovaslavina/fix-truncation-againmain
list: improve long envvar truncation UXrepos/cloud/toolforge/envvars-cli!19sstefanovaslavina/fix-list-truncatemain
Customize query in GitLab

Event Timeline

Slst2020 changed the task status from Open to In Progress.Jan 3 2024, 2:42 PM
Slst2020 moved this task from Next Up to In Progress on the Toolforge (Toolforge iteration 02) board.

@Amorymeltzer would this be better UX in your opinion?

toolsbeta.tf-test@bullseye:~/envvars-cli$ toolforge envvars list --help
Usage: toolforge envvars list [OPTIONS]

  List all your envvars.

Options:
  --json              If set, will output in json format
  --truncate BOOLEAN  Set to 'false' to display full envvar values. Defaults
                      to truncating long values.  [default: True]
  --help              Show this message and exit.

toolsbeta.tf-test@bullseye:~/envvars-cli$ toolforge envvars list
name    value
VAR1    val1
VAR2    vdslfj3489yt8934ythfiehfkehrf98p342ytifu3ehrfkjh38...

toolsbeta.tf-test@bullseye:~/envvars-cli$ toolforge envvars list --truncate=false
name    value
VAR1    val1
VAR2    vdslfj3489yt8934ythfiehfkehrf98p342ytifu3ehrfkjh38249ytr3i4uhwfkjerbfn9843ythfkjerbfiuy34hi7

Yes!


I see the --truncate option now, is it new, or did I miss it previously? If the latter, I'm quite sorry for taking up time.

What I see now on the tf is:

--truncate If set, will truncate long envvar values. Defaults to True.

And, confusingly, I have to provide it alone, with no value (Error: --truncate option does not take a value), to get the full output. I don't think I would have tried that had I not gone here. Your suggestion is much better.

Yes!


I see the --truncate option now, is it new, or did I miss it previously? If the latter, I'm quite sorry for taking up time.
What I see now on the tf is:

--truncate If set, will truncate long envvar values. Defaults to True.

And, confusingly, I have to provide it alone, with no value (Error: --truncate option does not take a value), to get the full output. I don't think I would have tried that had I not gone here. Your suggestion is much better.

Yes it already exists, but as you point out is confusing to use as it's counterintuitive that setting the flag turns off truncation.

I'll go ahead with the suggested new implementation – thank you for your input :D

Final implementation:

toolsbeta.tf-test@bullseye:~/envvars-cli$ toolforge envvars list --help
Usage: toolforge-envvars list [OPTIONS]

  List all your envvars.

Options:
  --json                      If set, will output in json format
  --truncate / --no-truncate  Set to '--no-truncate' to display full envvar
                              values. [default: truncate]
  --help                      Show this message and exit.

toolsbeta.tf-test@bullseye:~/envvars-cli$ toolforge envvars list
name    value
VAR1    val1
VAR2    vdslfj3489yt8934ythfiehfkehrf98p342ytifu3ehrfkjh38...

toolsbeta.tf-test@bullseye:~/envvars-cli$ toolforge-envvars list --no-truncate
name    value
VAR1    val1
VAR2    vdslfj3489yt8934ythfiehfkehrf98p342ytifu3ehrfkjh38249ytr3i4uhwfkjerbfn9843ythfkjerbfiuy34hi7

It seems to be truncating all of them no?

VAR1    val1...
taavi renamed this task from [buildservice] Feature request - Indicate when long envvars are cutoff when listing to Indicate when long envvars are cutoff when listing.Jan 9 2024, 2:23 PM

Deproyed it with toolforge-envvars-cli 0.0.4

dcaro moved this task from In Review to Done on the Toolforge (Toolforge iteration 03) board.