Skip to content
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

tasks: list tasks with proper alignment #912

Merged
merged 1 commit into from
Apr 24, 2021
Merged

tasks: list tasks with proper alignment #912

merged 1 commit into from
Apr 24, 2021

Conversation

kraptor
Copy link
Contributor

@kraptor kraptor commented Apr 21, 2021

This is a small QoL patch.

Currently, nimble lists tasks without proper alignment between the name and the description of the task:

$ nimble tasks
build_debug        Build debug version
build_release        Build release version
build_profiler        Build with profiler
build_all        Build all versions
clean        Clean all build files

This patch adds the ability to collect the max length of the tasks names (with a minimum of 8 characters), then render descriptions properly aligned:

$ ./nimble tasks
build_debug     Build debug version
build_release   Build release version
build_profiler  Build with profiler
build_all       Build all versions
clean           Clean all build files

I tried to keep the same code style as the code aroudn. Please, let me know if there is anything else you'd like to improve/change.

NOTE: this change may potentially break scripts dealing with nimble tasks output, as it does inject two spaces between task name and task description, instead of a bunch of spaces like before.

The following tests did not pass on master before, not sure if because of my installation of Nim (using 1.5.1-latest) or my system:

  • nimscript evaluation error message

src/nimblepkg/nimscriptapi.nim Outdated Show resolved Hide resolved
src/nimblepkg/nimscriptapi.nim Outdated Show resolved Hide resolved
src/nimblepkg/nimscriptapi.nim Outdated Show resolved Hide resolved
@kraptor kraptor requested a review from dom96 April 22, 2021 07:47
@kraptor
Copy link
Contributor Author

kraptor commented Apr 22, 2021

Ok, I see what is failing... let me fix printSeqIfLen template...

This patch adds the ability to collect the max length of the tasks
names (with a minimum of 8 characters), then render descriptions
with proper alignment.
@kraptor
Copy link
Contributor Author

kraptor commented Apr 22, 2021

I squashed the changes for easy review @dom96, everything seems ok now.

@dom96 dom96 merged commit f7b73db into nim-lang:master Apr 24, 2021
kraptor added a commit to kraptor/nimble that referenced this pull request Apr 24, 2021
kraptor added a commit to kraptor/nimble that referenced this pull request Apr 26, 2021
The tests cover:

- If there are no tasks defined
- If there are tasks with long names
- If the minimum alignment is respected for very short names
dom96 pushed a commit that referenced this pull request Apr 26, 2021
The tests cover:

- If there are no tasks defined
- If there are tasks with long names
- If the minimum alignment is respected for very short names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants