Back to Codeberg

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

forgejo-contrib-forgejo-cli-pulls-547.md

latest15.5 KB
Original Source

forgejo-contrib/forgejo-cli

Watch20

Star402

Fork

You've already forked forgejo-cli

51

CodeIssues 44Pull requests 8Releases 11Packages 2WikiActivity

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

Open

muller-md wants to merge 1 commit from muller-md/forgejo-cli:cwd into main

pull from: muller-md/forgejo-cli:cwd

merge into: forgejo-contrib:main

forgejo-contrib:main

forgejo-contrib:renovate/lock-file-maintenance

forgejo-contrib:renovate/serde-saphyr-0.x

forgejo-contrib:docs/contributing

forgejo-contrib:no-port-in-refspec

forgejo-contrib:login/v16.next.forgejo.org

forgejo-contrib:crates-io-publish

forgejo-contrib:0.5.x

forgejo-contrib:compile-time-fluent

forgejo-contrib:0.4.x

forgejo-contrib:localization-alias-demo

forgejo-contrib:api_url_field

Conversation 4Commits 1Files changed 2 +53 -40

muller-md commented 2026-07-03 10:33:24 +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.

muller-md added 1 commit 2026-07-03 10:33:24 +02:00

feat: Add --current-work-dir/-C CLI option for setting cwd

Some checks failed

ci/woodpecker/pr/check-typos Pipeline was successful

Details

ci/woodpecker/pr/check Pipeline failed

Details

ci/woodpecker/pr/check-clippy Pipeline was successful

Details

db37f0811b

muller-md force-pushed cwd from db37f0811b

Some checks failed

ci/woodpecker/pr/check-typos Pipeline was successful

Details

ci/woodpecker/pr/check Pipeline failed

Details

ci/woodpecker/pr/check-clippy Pipeline was successful

Details

to 0e5f8b2b2e

All checks were successful

ci/woodpecker/pr/check-typos Pipeline was successful

Details

ci/woodpecker/pr/check Pipeline was successful

Details

ci/woodpecker/pr/check-clippy Pipeline was successful

Details

2026-07-03 10:38:40 +02:00 Compare

Fluffinity requested changes 2026-07-03 15:03:35 +02:00

src/main.rs Outdated

Show resolved Hide resolved

| | | | @ -39,2 +39,4 @@ | | | | | | #[clap(long, short = 'H', global = true)] | | | | | | host: Option<String>, | | | | | | #[clap( | | | | | | long, |

Fluffinity commented 2026-07-03 15:01:19 +02:00

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.

πŸ‘ 1

muller-md commented 2026-07-03 15:05:46 +02:00

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

Show resolved Hide resolved

| | | | @ -41,0 +42,4 @@ | | | | | | long, | | | | | | short = 'C', | | | | | | global = true, | | | | | | help = "Sets the current working directory" |

Fluffinity commented 2026-07-03 15:02:54 +02:00

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

πŸ‘ 1

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

Details

ci/woodpecker/pr/check Pipeline was successful

Details

ci/woodpecker/pr/check-clippy Pipeline was successful

Details

to 3434b1a701

All checks were successful

ci/woodpecker/pr/check-typos Pipeline was successful

Details

ci/woodpecker/pr/check Pipeline was successful

Details

ci/woodpecker/pr/check-clippy Pipeline was successful

Details

2026-07-03 15:14:56 +02:00 Compare

muller-md commented 2026-07-03 15:16:14 +02:00

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

πŸ‘ 1

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

Cyborus reviewed 2026-07-06 20:05:16 +02:00

src/main.rs Outdated

Show resolved Hide resolved

| | | | @ -41,0 +44,4 @@ | | | | | | global = true, | | | | | | help = h!("arg-cwd") | | | | | | )] | | | | | | cwd: Option<String>, |

Cyborus commented 2026-07-06 20:05:16 +02:00

Member

Copy link

Could this be Option<PathBuf>?

Could this be Option\<PathBuf\>?

πŸ‘ 1

muller-md commented 2026-07-07 07:40:55 +02:00

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

Details

ci/woodpecker/pr/check Pipeline was successful

Details

ci/woodpecker/pr/check-clippy Pipeline was successful

Details

to 7eba5a4d4a

All checks were successful

ci/woodpecker/pr/check-typos Pipeline was successful

Details

ci/woodpecker/pr/check Pipeline was successful

Details

ci/woodpecker/pr/check-clippy Pipeline was successful

Details

2026-07-07 07:40:41 +02:00 Compare

muller-md commented 2026-07-07 07:41:50 +02:00

Author

Contributor

Copy link

Changes:

  • Replaced String -> PathBuf for cwd arg.

Changes: - Replaced String -> PathBuf for cwd arg.

All checks were successful Hide all checks

ci/woodpecker/pr/check-typos Pipeline was successful

Details

ci/woodpecker/pr/check Pipeline was successful

Required Details

ci/woodpecker/pr/check-clippy Pipeline was successful

Details

This pull request can be merged automatically.

This branch is out-of-date with the base branch

You are not authorized to merge this pull request.

View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u cwd:muller-md-cwd

git switch muller-md-cwd

Sign in to join this conversation.

Reviewers

No reviewers

Fluffinity

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

](#)

No labels Kind/Breaking Kind/Bug Kind/Design Kind/Documentation Kind/Enhancement Kind/Feature Kind/Security Kind/Testing Kind/Upstream [ Priority

Critical ](/forgejo-contrib/forgejo-cli/pulls?labels=173012) [ Priority

High ](/forgejo-contrib/forgejo-cli/pulls?labels=173013) [ Priority

Low ](/forgejo-contrib/forgejo-cli/pulls?labels=173015) [ Priority

Medium ](/forgejo-contrib/forgejo-cli/pulls?labels=173014) [ Reviewed

Confirmed ](/forgejo-contrib/forgejo-cli/pulls?labels=173007) [ Reviewed

Duplicate ](/forgejo-contrib/forgejo-cli/pulls?labels=173005) [ Reviewed

Invalid ](/forgejo-contrib/forgejo-cli/pulls?labels=173006) [ Reviewed

Won't Fix ](/forgejo-contrib/forgejo-cli/pulls?labels=173008) [ Status

Abandoned ](/forgejo-contrib/forgejo-cli/pulls?labels=173011) [ Status

Blocked ](/forgejo-contrib/forgejo-cli/pulls?labels=173010) [ Status

Need More Info ](/forgejo-contrib/forgejo-cli/pulls?labels=173009) Suspicious

Milestone

Clear milestone

No items

No milestone

Projects

Clear projects

No items

No project

Assignees

Clear assignees

No assignees

3 participants

Notifications Subscribe

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

WritePreview

Loading…

Add table

| Rows | | | Columns | |

CancelOK

Add a link

Url Description Hint: With a URL in your clipboard, you can paste directly into the editor to create a link.

CancelOK

CancelSave

Reference in a new issue

Repository

forgejo-contrib/forgejo-cli

Title

Body

Create issue

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?

No Yes