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

Suppress private visibility arguments in generate-manual output #665

Open
2 tasks done
monoxygen opened this issue Sep 16, 2024 · 1 comment
Open
2 tasks done

Suppress private visibility arguments in generate-manual output #665

monoxygen opened this issue Sep 16, 2024 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@monoxygen
Copy link

Arguments that specify private visibility, such as:

@Flag(help: ArgumentHelp(visibility: .private))
var hiddenFromHelp: Bool = false

show up in the man page generated by the generate-manual command:

.It Fl -hidden-from-help

If private visibility indicates that help should never be shown for that argument, it seems reasonable and desirable that it also not be visible in man pages.

ArgumentParser version: 1.5.0
Swift version: swift-driver version: 1.110 Apple Swift version 6.0 (swiftlang-6.0.0.4.52 clang-1600.0.21.1.3)

Checklist

  • If possible, I've reproduced the issue using the main branch of this package
  • I've searched for existing GitHub issues

Steps to Reproduce

  1. Define an argument with private visibility, such as the hiddenFromHelp argument above
  2. Build the client executable at path <executable>
  3. Run swift run generate-manual <executable> --output-directory <outputdir>

Expected behavior

hiddenFromHelp should not be included in the man page generated at <outputdir>

Actual behavior

hiddenFromHelp is included in the man page generated at <outputdir>

@rauhul rauhul added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Sep 16, 2024
heckj added a commit to heckj/swift-argument-parser that referenced this issue Sep 19, 2024
@heckj
Copy link
Contributor

heckj commented Sep 19, 2024

Saw the bug listing while I was digging around the repo related to dumping the help output. The arguments are annotated with visibility information up front, but it wasn't evaluated when generating the manual output, so my PR (#667) checks that additional property before generating relevant content. The existing Math example in the test output included "hidden" content, so I've updated the tests to match - the arguments marked as hidden shouldn't be in the resulting output.

I think I've matched style, etc - but more than happy to tweak or change if something is amiss or isn't following a preferred pattern for this additional check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants