forgejo-contrib/forgejo-cli
20
407
Fork
You've already forked forgejo-cli
51

feat: Add --cwd/-C CLI option for setting cwd #547

Merged
Cyborus merged 1 commit from muller-md/forgejo-cli:cwd into main 2026年07月11日 21:10:11 +02:00
Contributor
Copy link

Changes Made

Mimics git -C path/to/git/dir to run fj as if it was started in the <current_work_dir> instead of the initial working directory.

More convenient than running (cd dir/ && fj ...) in scripting.

Code of Conduct

  • I agree to act in accordance with the CoC & AI Agreement.
  • This contribution was not generated by an LLM, even in part.
### Changes Made Mimics `git -C path/to/git/dir` to run `fj` as if it was started in the <current_work_dir> instead of the initial working directory. More convenient than running `(cd dir/ && fj ...)` in scripting. ### Code of Conduct - [x] I agree to act in accordance with the CoC & AI Agreement. - [x] This contribution was not generated by an LLM, even in part.
feat: Add --current-work-dir/-C CLI option for setting cwd
Some checks failed
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline failed
ci/woodpecker/pr/check-clippy Pipeline was successful
db37f0811b
muller-md force-pushed cwd from db37f0811b
Some checks failed
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline failed
ci/woodpecker/pr/check-clippy Pipeline was successful
to 0e5f8b2b2e
All checks were successful
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
ci/woodpecker/pr/check-clippy Pipeline was successful
2026年07月03日 10:38:40 +02:00
Compare
src/main.rs Outdated
@ -39,2 +39,4 @@
#[clap(long, short = 'H', global = true)]
host: Option<String>,
#[clap(
long,
Contributor
Copy link

It would be better to have the long name to be cwd. Writing out the full current-work-dir seems excessive.

It would be better to have the long name to be `cwd`. Writing out the full `current-work-dir` seems excessive.
Author
Contributor
Copy link

Thanks. Thought about cwd first but felt a bit clunky on the command line.

Thanks. Thought about `cwd` first but felt a bit clunky on the command line.
Cyborus marked this conversation as resolved
src/main.rs Outdated
@ -41,0 +42,4 @@
long,
short='C',
global=true,
help="Sets the current working directory"
Contributor
Copy link

This help message needs to be localized. Use the h! macro for that and add the corresponding message in localization/en-US/messages.ftl

This help message needs to be localized. Use the `h!` macro for that and add the corresponding message in `localization/en-US/messages.ftl`
Cyborus marked this conversation as resolved
muller-md force-pushed cwd from 0e5f8b2b2e
All checks were successful
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
ci/woodpecker/pr/check-clippy Pipeline was successful
to 3434b1a701
All checks were successful
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
ci/woodpecker/pr/check-clippy Pipeline was successful
2026年07月03日 15:14:56 +02:00
Compare
Author
Contributor
Copy link

Changes:

  • Shortened arg to cwd
  • Made the help string localize'able with en-US translation
Changes: - Shortened arg to `cwd` - Made the help string localize'able with en-US translation
muller-md changed title from (削除) feat: Add --current-work-dir/-C CLI option for setting cwd (削除ここまで) to feat: Add --cwd/-C CLI option for setting cwd 2026年07月03日 20:50:15 +02:00
src/main.rs Outdated
@ -41,0 +44,4 @@
global=true,
help=h!("arg-cwd")
)]
cwd: Option<String>,
Member
Copy link

Could this be Option<PathBuf>?

Could this be `Option<PathBuf>`?
Author
Contributor
Copy link

This is a very good point! Done.

This is a very good point! Done.
muller-md marked this conversation as resolved
muller-md force-pushed cwd from 3434b1a701
All checks were successful
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
ci/woodpecker/pr/check-clippy Pipeline was successful
to 7eba5a4d4a
All checks were successful
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
ci/woodpecker/pr/check-clippy Pipeline was successful
2026年07月07日 07:40:41 +02:00
Compare
Author
Contributor
Copy link

Changes:

  • Replaced String -> PathBuf for cwd arg.
Changes: - Replaced `String` -> `PathBuf` for `cwd` arg.
muller-md force-pushed cwd from 7eba5a4d4a
All checks were successful
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
ci/woodpecker/pr/check-clippy Pipeline was successful
to 33370d7a0b
All checks were successful
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
ci/woodpecker/pr/check-clippy Pipeline was successful
2026年07月08日 10:46:03 +02:00
Compare
Author
Contributor
Copy link

Changes:

  • Removed unrelated whitespace changes
Changes: - Removed unrelated whitespace changes
Sign in to join this conversation.
No reviewers
Labels
Clear labels
Kind/Breaking
Breaking change that won't be backward compatible
Kind/Bug
Something is not working
Kind/Design
Discussion about UI/UX design
Kind/Documentation
Documentation changes
Kind/Enhancement
Improve existing functionality
Kind/Feature
New functionality
Kind/Security
This is security issue
Kind/Testing
Issue or pull request related to testing
Kind/Upstream
This is an issue with upstream software (Forgejo) that is probably not our fault
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
Suspicious
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo-contrib/forgejo-cli!547
Reference in a new issue
forgejo-contrib/forgejo-cli
No description provided.
Delete branch "muller-md/forgejo-cli:cwd"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?