Skip to content

Help & Docs#71

Merged
MusicalNinjaDad merged 3 commits into
mainfrom
help
Oct 27, 2025
Merged

Help & Docs#71
MusicalNinjaDad merged 3 commits into
mainfrom
help

Conversation

@MusicalNinjaDad

@MusicalNinjaDad MusicalNinjaDad commented Oct 27, 2025

Copy link
Copy Markdown
Owner

Summary by Sourcery

Standardize the in-place option and overhaul the CLI help and documentation to provide clearer usage guidance.

Enhancements:

  • Standardize the in-place flag to "--in-place" and rename the Inplace API to InPlace for consistency
  • Introduce a custom usage template with multiple usage patterns and disable the default flags-in-use line
  • Enhance help notes with detailed explanations for file vs directory modes and explicit mappings of executables vs libraries

Documentation:

  • Add structured usage examples and detailed notes to user-facing help output

Tests:

  • Update CLI and unit tests to use the new "--in-place" flag and InPlace() method

@sourcery-ai

sourcery-ai Bot commented Oct 27, 2025

Copy link
Copy Markdown

Reviewer's Guide

Refactors the CLI usage and help system by extracting dynamic usage lines and customizing the Cobra help template; renames the in-place flag and corresponding Option method to consistent hyphenation; and enriches documentation and comments to cover directory support, recursive behavior, and clarify file mapping.

Class diagram for updated Option methods and flags

classDiagram
    class options {
      +bool inplace
      +bool recursive
    }
    class Option {
      <<function>>
    }
    Option <|.. InPlace
    Option <|.. Recursive
    options o-- Option
    InPlace : Option func(*options)
    Recursive : Option func(*options)
    InPlace : sets o.inplace = true
    Recursive : sets o.recursive = true
Loading

Flow diagram for enriched file/directory handling and flag logic

flowchart TD
    A["User runs snaggle command"] --> B{Is path a file or directory?}
    B -- File --> C["Snag file and dependencies to DESTINATION"]
    B -- Directory --> D["Snag all valid ELF binaries in directory"]
    D --> E{Recursive flag set?}
    E -- Yes --> F["Recurse subdirectories and snag all ELF binaries"]
    E -- No --> G["Snag only binaries directly under directory"]
    C & F & G --> H["Apply --in-place flag if set"]
    H --> I["Hardlink or copy files as needed"]
Loading

File-Level Changes

Change Details Files
Revamped command usage and help template
  • Replaced static 'Use' value with a dynamic usages slice
  • Disabled flags in the usage line via DisableFlagsInUseLine
  • Joined the default help template with custom notes and exit codes
  • Introduced a 'usages' variable defining two invocation forms
snaggle/main.go
Renamed in-place flag and Option method
  • Changed the CLI flag from '--inplace' to '--in-place'
  • Renamed the Option function from Inplace() to InPlace()
  • Updated test cases to use '--in-place'
  • Replaced internal calls to snaggle.Inplace() with snaggle.InPlace()
snaggle/main.go
snaggle/cli_test.go
snaggle_test.go
snaggle.go
Enhanced documentation and comments
  • Expanded the helpNotes with detailed file vs directory usage scenarios
  • Refined list formatting for executables and dynamic libraries
  • Updated the Snaggle function doc comment to describe directory support and recursive/in-place options
  • Corrected phrasing in notes about filesystem differences
snaggle/main.go
snaggle.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Consider moving the multi-line usage patterns into the Cobra Examples field and re-enabling the default flag usage line to leverage built-in formatting.
  • The helpNotes text and the Snaggle function doc comments now overlap—consolidate them to avoid duplication and drift.
  • Renaming the Inplace option to InPlace is a public API change—please update any external references and bump the major version if this is a breaking change.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider moving the multi-line usage patterns into the Cobra Examples field and re-enabling the default flag usage line to leverage built-in formatting.
- The helpNotes text and the Snaggle function doc comments now overlap—consolidate them to avoid duplication and drift.
- Renaming the Inplace option to InPlace is a public API change—please update any external references and bump the major version if this is a breaking change.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@MusicalNinjaDad MusicalNinjaDad enabled auto-merge (squash) October 27, 2025 19:43
@MusicalNinjaDad MusicalNinjaDad merged commit 0549b14 into main Oct 27, 2025
7 checks passed
@MusicalNinjaDad MusicalNinjaDad deleted the help branch October 27, 2025 19:43
@MusicalNinjaDad MusicalNinjaDad linked an issue Oct 27, 2025 that may be closed by this pull request
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.

Update & fix Usage help

1 participant