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

Sort flags alphabetically #4062

Merged
merged 3 commits into from
Apr 15, 2021
Merged

Sort flags alphabetically #4062

merged 3 commits into from
Apr 15, 2021

Conversation

wiardvanrij
Copy link
Member

@wiardvanrij wiardvanrij commented Apr 14, 2021

Signed-off-by: Wiard van Rij [email protected]

Relates to #4034

It sorts the flags alphabetical

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

The latest release of the kingpin package is from 17 Dec 2017. It was missing any method to do some funky stuff to get this done. That is, unless we want to manually order all flags in the code. So;

  • Replaced v2.2.6 of kingpin with latest commit on their master branch so UsageFuncs becomes available
  • Used the default template with an extra function call before the flag output
  • Added a function that does a sort on flag name

I think this might fall under "it's not stupid if it works" but this change felt nasty lol. Open for review anyway, LMK.

Verification

Locally tested.
Will update further if this is the way to go...

Signed-off-by: Wiard van Rij <[email protected]>
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Can we try running make docs to update our docs? 🤗

pkg/extkingpin/app.go Outdated Show resolved Hide resolved
@bwplotka bwplotka changed the title sort flags alphabetical Sort flags alphabetically Apr 15, 2021
@wiardvanrij
Copy link
Member Author

Nice!

Can we try running make docs to update our docs? 🤗

Yea, I wanted to review this first and discuss it before making it final :)

@wiardvanrij
Copy link
Member Author

wiardvanrij commented Apr 15, 2021

I don't know why the test is failing.

Local:

make docs
all modules verified
>> building Thanos binary in /Users/wiard/go/bin
 >   thanos
>> generating docs
msg=success
>> cleaning white noise

->

 make check-docs
all modules verified
>> building Thanos binary in /Users/wiard/go/bin
 >   thanos
>> checking docs generation
msg=success
>> checking links (DISABLED for now)

Committed all the docs

edit;

-      --tmp.dir="/var/folders/7q/nd_xkppx783clb5nc5zzts6c0000gn/T/thanos-rewrite"
+      --tmp.dir="/tmp/thanos-rewrite"

Guess I have something odd on my machine... will manually fix this.

@bwplotka
Copy link
Member

Now all works, just flaky test, retried

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! LGTM!

cc @idoqo

@wiardvanrij
Copy link
Member Author

Now all works, just flaky test, retried

It's because I cannot access /tmp locally - non-root (: It makes up some funky /var directory. I manually fixed this (:
Also I'm taking over your smiley behaviour..

@bwplotka bwplotka enabled auto-merge (squash) April 15, 2021 14:17
@idoqo
Copy link
Contributor

idoqo commented Apr 15, 2021

Thank you! LGTM!

cc @idoqo

Right, looks great! Will update the docs in #3993 and see how that goes. Thanks @wiardvanrij

@bwplotka bwplotka merged commit a4103dd into thanos-io:main Apr 15, 2021
someshkoli pushed a commit to someshkoli/thanos that referenced this pull request Apr 21, 2021
* sort flags alphabetical

Signed-off-by: Wiard van Rij <[email protected]>

* Update changelog, docs and rename sort function

Signed-off-by: Wiard van Rij <[email protected]>

* fixes docs, something odd on my machine

Signed-off-by: Wiard van Rij <[email protected]>
Signed-off-by: someshkoli <[email protected]>
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.

3 participants