fix: add --version flag and skip orphan temp files#45
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8e50685bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| log.Fatal("Usage: find-replace FIND REPLACE") | ||
| showVersion := flag.Bool("version", false, "print version and exit") | ||
| showVersionShort := flag.Bool("v", false, "print version and exit (shorthand)") | ||
| flag.Parse() |
There was a problem hiding this comment.
Handle leading-dash search terms
Calling flag.Parse() here makes the first positional argument go through flag parsing, so invocations like find-replace -foo bar now fail with an unknown-flag error instead of treating -foo as the literal search string. Before this commit, any two strings were accepted via os.Args, so this is a functional regression for users replacing tokens that begin with - (common in CLI/docs text) unless they know to add --.
Useful? React with 👍 / 👎.
Summary
version.gofor ldflags-injected build metadata and-v/--version..find-replace-and skip them on later runs.Fixes #26
Fixes #21
Made with Cursor