-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
list
output column misalignment
#412
Comments
This is much worse when piping through fzf. |
list
output column misalignment
@mas-cli/contributors TL;DR: solution:
All formatting of output should be done by the Users can configure the output via environment variables. e.g., when mas-json list | jq -r '(.[] | [.id, .name, .version]) | @tsv' | column -ts $'\t' -R 1
The mas brew formula would depend on Example except from proposed #!/usr/bin/env zsh
case "${1}" in
list)
eval "mas-json ${@} ${MAS_LIST_FORMAT-| jq -r '${MAS_LIST_FORMAT_JQ:-(.[] | [.id, .name, .version])} | @tsv' | column -ts $'\t' ${MAS_LIST_FORMAT_COLUMNS--R 1}}"
;;
*)
mas-json "${*}"
;;
esac The above uses the following environment variables to reconfigure output:
Reasons why the above solution is advisable:It is basically impossible to determine the displayed or occupied widths of characters in Swift because:
UNIX principle: Do one thing very well / separate concerns; in this case, i.e. separate data from display. Users could completely change the display however they want. It's much easier to parse JSON than text that was attempted to be formatted into columns. Also, the JSON can include many fields that aren't displayed by default, so users can choose or remove columns easily, apply text colors or other formatting, etc. |
My worry about this project providing a user-editable I'm not opposed to the idea of a new front-end script, just calling out a potential snag that needs to be investigated. Many CLI tools have an optional JSON output by passing a |
I wasn't planning on having users normally edit the script. It was more if they wanted to edit it, then they could, then submit changes to the repo. But, we should be able to offer enough config options via environment variables or just allowing them to pipe JSON to |
Your Environment
mas version
:stable 1.8.3system_profiler SPSoftwareDataType -detailLevel mini
): 10.15.7 (19H1323)mas Install Method
brew install mas
(homebrew-core)Describe the Bug
mas list command output disalignment.
To Reproduce
Steps to reproduce the behavior:
Screenshots, Terminal Output
The text was updated successfully, but these errors were encountered: