Skip to content

Commit

Permalink
introduce new option that allows reusing args with cargo commands
Browse files Browse the repository at this point in the history
instead of running the rerun commands in order to apply stored arguments
  • Loading branch information
brotzeit committed Nov 19, 2022
1 parent 1b4c99d commit 064aeef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ Customization:
- `rustic-cargo-check-arguments` default arguments for cargo check
- `rustic-cargo-auto-add-missing-dependencies` automatically add missing dependencies
to Cargo.toml by checking new diagnostics for 'unresolved import' errors
- `rustic-cargo-use-last-stored-arguments` always use stored arguments that were provided with `C-u`(instead of requiring to run rustic "rerun" commands)

### Edit

Expand Down
16 changes: 14 additions & 2 deletions rustic-cargo.el
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ If nil then the project is simply created."
:type 'boolean
:group 'rustic-cargo)

(defcustom rustic-cargo-use-last-stored-arguments nil
"Always rerun cargo commands with stored arguments.
Example:
When `rustic-cargo-use-last-stored-arguments' is `nil', then
rustic-cargo-test will always use `rustic-default-test-arguments'.
If you set it to `t', you can reuse the arguments with `rustic-cargo-test'
instead of applying the default arguments from `rustic-default-test-arguments'."
:type 'boolean
:group 'rustic-cargo)

(defcustom rustic-default-test-arguments "--benches --tests --all-features"
"Default arguments when running 'cargo test'."
:type 'string
Expand Down Expand Up @@ -172,7 +184,7 @@ When calling this function from `rustic-popup-mode', always use the value of
(rustic-cargo-test-run
(cond (arg
(setq rustic-test-arguments (read-from-minibuffer "Cargo test arguments: " rustic-default-test-arguments)))
((eq major-mode 'rustic-popup-mode)
(rustic-cargo-use-last-stored-arguments
(if (> (length rustic-test-arguments) 0)
rustic-test-arguments
rustic-default-test-arguments))
Expand Down Expand Up @@ -600,7 +612,7 @@ When calling this function from `rustic-popup-mode', always use the value of
(rustic-cargo-run-command
(cond (arg
(setq rustic-run-arguments (read-from-minibuffer "Cargo run arguments: " rustic-run-arguments)))
((eq major-mode 'rustic-popup-mode)
(rustic-cargo-use-last-stored-arguments
rustic-run-arguments)
((rustic--get-run-arguments))
(t ""))))
Expand Down

0 comments on commit 064aeef

Please sign in to comment.