Skip to content

Conversation

caarlos0
Copy link
Member

@caarlos0 caarlos0 commented Jun 27, 2025

pipes |, stdin -, and single quotes were not being handled properly.

this fixes it.

CleanShot 2025-06-27 at 14 33 52@2x

@caarlos0 caarlos0 requested a review from Copilot June 27, 2025 17:34
@caarlos0 caarlos0 self-assigned this Jun 27, 2025
@caarlos0 caarlos0 added the enhancement New feature or request label Jun 27, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request improves the handling of pipe characters (|) and standard input (-) in command examples. Key changes include:

  • Updating the indentation logic in help.go to account for pipe characters.
  • Modifying quoted string and flag detection to support both double and single quotes.
  • Adding new pipe examples in testdata, fang_test.go, and example/main.go to verify the behavior.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
testdata/TestSetup/with_examples/help.golden Added examples showcasing pipe usage and stdin handling.
help.go Updated logic for indent determination and argument styling.
fang_test.go Included new test examples for pipe and stdin scenarios.
example/main.go Provided updated inline examples for pipe-based command usage.
Comments suppressed due to low confidence (2)

help.go:263

  • Verify that the switch cases for single-character '-' and '|' are intentional and do not conflict with standard flag processing for similar symbols.
		if len(arg) == 1 {

@caarlos0 caarlos0 changed the title feat: better handle pipes, single quotes, stdin (-) fix: better handle pipes, single quotes, stdin (-) Jun 27, 2025
@caarlos0 caarlos0 merged commit 3fe7faa into main Jun 30, 2025
18 checks passed
@caarlos0 caarlos0 deleted the pipes branch June 30, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant