Skip to content

feat(init): add -f as short alias for --force#329

Merged
jdx merged 3 commits intomainfrom
feat/force-short-flag
Mar 8, 2026
Merged

feat(init): add -f as short alias for --force#329
jdx merged 3 commits intomainfrom
feat/force-short-flag

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Mar 8, 2026

Summary

  • Add -f short flag for --force on the init command
  • The import and sync commands already had -f; this makes it consistent

Test plan

  • cargo check passes
  • Verify fnox init -f works as expected

🤖 Generated with Claude Code


Note

Low Risk
Small CLI flag metadata change with no impact to config generation logic beyond how the option is invoked.

Overview
Adds -f as a short option for the init command’s --force flag, aligning the CLI UX with other commands that already support -f for overwrite/skip confirmations.

Written by Cursor Bugbot for commit cf8853f. This will update automatically on new commits. Configure here.

The import and sync commands already had -f, but init was missing it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the init command by introducing a short alias for the --force flag, making it more convenient to use. This change also standardizes the command-line interface across related operations, improving user experience and consistency within the application.

Highlights

  • Command Line Interface: Added -f as a short alias for the --force flag to the init command, providing a more concise way to invoke force operations.
  • Consistency: Ensured consistency across commands by aligning the init command's flag behavior with the existing import and sync commands, which already supported the -f flag.
Changelog
  • src/commands/init.rs
    • Added short attribute to the force argument, enabling -f as an alias for --force.
Activity
  • The author confirmed that cargo check passes.
  • The author indicated a plan to verify fnox init -f functionality.
  • The pull request was generated with Claude Code.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@jdx jdx enabled auto-merge (squash) March 8, 2026 20:13
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds the -f short alias for the --force flag on the init command. No security vulnerabilities were found. However, while the implementation is correct, the change is incomplete as it's missing updates to documentation and tests.

Comment thread src/commands/init.rs

/// Overwrite existing configuration file
#[arg(long)]
#[arg(short, long)]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This change is incomplete without corresponding updates to documentation and tests.

  • The documentation in docs/cli/init.md should be updated to include the new -f flag. It appears this file is auto-generated, so you may need to run a script to update it.
  • A test case should be added to test/init.bats to verify that fnox init -f works as expected and prevents future regressions. The test plan in the PR description indicates this is a pending task.

Please add these changes to complete the feature.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Mar 8, 2026

Greptile Summary

This PR adds -f as a short alias for --force on the init command, bringing it in line with the import and sync commands which already support this shorthand. All four changed files (src/commands/init.rs, fnox.usage.kdl, docs/cli/commands.json, docs/cli/init.md) are updated consistently, and the flags are reordered alphabetically (-f before -g).

  • src/commands/init.rs: #[arg(long)] changed to #[arg(short, long)] on the force field; field reordered before global
  • fnox.usage.kdl: Flag updated from --force to "-f --force", reordered before -g --global
  • docs/cli/commands.json: "short": [] updated to "short": ["f"], entry moved before global
  • docs/cli/init.md: Header updated from ### \--force`to### `-f --force``, section reordered
  • Minor: the error message on line 41 of init.rs still reads "Use --force to overwrite." and should be updated to "Use -f/--force to overwrite." to reflect the new alias

Confidence Score: 5/5

  • This PR is safe to merge — it is a pure CLI metadata change with no impact on business logic.
  • The change is minimal and isolated to flag declaration and documentation. No logic paths are added or altered; only the way the flag is invoked on the CLI changes. All affected files are updated consistently.
  • No files require special attention beyond the minor error-message update in src/commands/init.rs.

Important Files Changed

Filename Overview
src/commands/init.rs Added #[arg(short, long)] to the force field and reordered it before global; logic is unchanged. Minor: error message on line 41 still only mentions --force, not the new -f alias.
fnox.usage.kdl Updated --force flag definition to "-f --force" and reordered it before -g --global; matches the Rust struct change.
docs/cli/commands.json Added "short": ["f"] to the force flag entry and moved it before global; consistent with the source change.
docs/cli/init.md Updated docs to show -f --force header and reordered flags alphabetically; no issues.

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as fnox CLI (clap)
    participant Init as InitCommand::run()

    User->>CLI: fnox init -f (or --force)
    CLI->>Init: force=true, global=false, skip_wizard=false
    Init->>Init: config_path.exists() && !self.force → false (skip error)
    Init->>Init: run_wizard() or Config::new()
    Init->>User: ✓ Created new fnox configuration at '...'

    User->>CLI: fnox init (no flag, file exists)
    CLI->>Init: force=false
    Init->>Init: config_path.exists() && !self.force → true
    Init->>User: Error: "already exists. Use --force to overwrite."
Loading

Comments Outside Diff (1)

  1. src/commands/init.rs, line 41-43 (link)

    Error message doesn't reflect new -f shorthand

    Now that -f is a valid alias for --force, the error message shown when the config file already exists only mentions --force. Users who see this message won't know about the shorter flag. Consider updating it to mention both forms for consistency.

Fix All in Claude Code

Last reviewed commit: 7526105

@jdx jdx merged commit 99df037 into main Mar 8, 2026
14 checks passed
@jdx jdx deleted the feat/force-short-flag branch March 8, 2026 20:35
jdx pushed a commit that referenced this pull request Mar 9, 2026
### 🚀 Features

- **(cloudflare)** add Cloudflare API token lease backend by
[@jdx](https://github.com/jdx) in
[#335](#335)
- **(fido2)** bump demand to v2, mask PIN during typing by
[@jdx](https://github.com/jdx) in
[#334](#334)
- **(init)** add -f as short alias for --force by
[@jdx](https://github.com/jdx) in
[#329](#329)
- **(lease)** add --all flag, default to creating all leases by
[@jdx](https://github.com/jdx) in
[#337](#337)
- **(lease)** add GitHub App installation token lease backend by
[@jdx](https://github.com/jdx) in
[#342](#342)

### 🐛 Bug Fixes

- **(config)** fix directory locations to follow XDG spec by
[@jdx](https://github.com/jdx) in
[#336](#336)
- **(exec)** use unix exec and exit silently on subprocess failure by
[@jdx](https://github.com/jdx) in
[#339](#339)
- **(fido2)** remove duplicate touch prompt by
[@jdx](https://github.com/jdx) in
[#332](#332)
- **(set)** write to lowest-priority existing config file by
[@jdx](https://github.com/jdx) in
[#331](#331)
- **(tui)** skip providers requiring interactive auth by
[@jdx](https://github.com/jdx) in
[#333](#333)

### 🛡️ Security

- **(ci)** retry lint step to handle transient pkl fetch failures by
[@jdx](https://github.com/jdx) in
[#341](#341)
- **(mcp)** add MCP server for secret-gated AI agent access by
[@jdx](https://github.com/jdx) in
[#343](#343)
- add guide for fnox sync by [@jdx](https://github.com/jdx) in
[#328](#328)

### 🔍 Other Changes

- share Rust cache across CI jobs by [@jdx](https://github.com/jdx) in
[#340](#340)
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.

1 participant