Repository navigation
Closed
Labels
Description
Describe the bug
If a space-separated table has an empty element (i.e. there is a row that has no value for some column), from-ssv will not detect this and shift all the next element to the left.
To Reproduce
Run some command that has space-separated table with an empty element.
In the following example the PORTS column is empty for the first element. Because of this, the value of the next column (NAMES) is shifted to the left and from-ssv splits the data into 2 tables.
❯ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a41566c3765f docsrs_web "/opt/docsrs/entrypo…" 2 minutes ago Up 2 minutes docsrs_web_run_1ab629ca8b57
c009496a92d6 postgres:alpine "docker-entrypoint.s…" 3 minutes ago Up 3 minutes 5432/tcp docsrs_db_1
❯ docker ps | from-ssv
───┬──────────────┬────────────┬────────────────────────┬───────────────┬──────────────┬─────────────────────────────
# │ CONTAINER ID │ IMAGE │ COMMAND │ CREATED │ STATUS │ PORTS
───┼──────────────┼────────────┼────────────────────────┼───────────────┼──────────────┼─────────────────────────────
0 │ a41566c3765f │ docsrs_web │ "/opt/docsrs/entrypo…" │ 2 minutes ago │ Up 2 minutes │ docsrs_web_run_1ab629ca8b57
───┴──────────────┴────────────┴────────────────────────┴───────────────┴──────────────┴─────────────────────────────
───┬──────────────┬─────────────────┬────────────────────────┬───────────────┬──────────────┬──────────┬─────────────
# │ CONTAINER ID │ IMAGE │ COMMAND │ CREATED │ STATUS │ PORTS │ NAMES
───┼──────────────┼─────────────────┼────────────────────────┼───────────────┼──────────────┼──────────┼─────────────
1 │ c009496a92d6 │ postgres:alpine │ "docker-entrypoint.s…" │ 3 minutes ago │ Up 3 minutes │ 5432/tcp │ docsrs_db_1
───┴──────────────┴─────────────────┴────────────────────────┴───────────────┴──────────────┴──────────┴─────────────
Expected behavior
I would expect from-ssv to detect if a column is empty and display the table correctly.
❯ docker ps | from-ssv
───┬──────────────┬─────────────────┬────────────────────────┬───────────────┬──────────────┬──────────┬────────────────────────────
# │ CONTAINER ID │ IMAGE │ COMMAND │ CREATED │ STATUS │ PORTS | NAMES
───┼──────────────┼─────────────────┼────────────────────────┼───────────────┼──────────────┼──────────┼────────────────────────────
0 │ a41566c3765f │ docsrs_web │ "/opt/docsrs/entrypo…" │ 2 minutes ago │ Up 2 minutes │ | docsrs_web_run_1ab629ca8b57
1 │ c009496a92d6 │ postgres:alpine │ "docker-entrypoint.s…" │ 3 minutes ago │ Up 3 minutes │ 5432/tcp │ docsrs_db_1
───┴──────────────┴─────────────────┴────────────────────────┴───────────────┴──────────────┴──────────┴────────────────────────────
Screenshots
N/A
Configuration (please complete the following information):
Nu 0.9.0
Activity
thegedge commentedon Feb 15, 2020
I think this is working as expected. If you use
--aligned-columnsyou'll get the expected result. What do you think, @kvrhdn ?yvrhdn commentedon Feb 16, 2020
Using
--aligned-columsfixes this indeed! Note to myself: check the help page a bit more 😅But it's not clear to me why this isn't the default behaviour? In which cases would you not want to parse using aligned columns?
thegedge commentedon Feb 16, 2020
I'm not 100% sure why it wasn't chosen as the default, but my guess would be that there's a cost to aligned columns, so whoever created this command would like for the user to explicitly request that, or perhaps there are examples of commands that don't align the columns (I can't think of any right now), or maybe a bit of both.
Either way, we're really hoping to get aliases in soon, so if you wanted aligned columns to be the default, it should be easy to set up an alias that makes it do so 🎉 (I've done this for a lot of commands in my zsh profile)
ilius commentedon Feb 7, 2021
I started defining functions in
config.tomlin startup section.https://github.com/nushell/nushell/blob/main/docs/sample_config/config.toml
Once you get used to them, you will have much more power!
Aliases are very limited, for example you can't use pipe, unlike Bash.
But even in Bash, functions are recommended over aliases (except maybe for very simple cases).
github-actions commentedon Jun 24, 2021
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
github-actions commentedon Jul 7, 2021
This issue has been marked stale for more than 10 days without activity. Closing this issue, but if you find that the issue is still valid, please reopen.