File tree Expand file tree Collapse file tree 5 files changed +24
-11
lines changed Expand file tree Collapse file tree 5 files changed +24
-11
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ edition = "2021"
16
16
license = " MIT OR Apache-2.0"
17
17
18
18
[workspace .dependencies ]
19
+ anstyle = " 1.0.3"
19
20
anyhow = " 1.0.75"
20
21
base64 = " 0.21.3"
21
22
bytesize = " 1.3"
@@ -121,6 +122,7 @@ name = "cargo"
121
122
path = " src/cargo/lib.rs"
122
123
123
124
[dependencies ]
125
+ anstyle.workspace = true
124
126
anyhow.workspace = true
125
127
base64.workspace = true
126
128
bytesize.workspace = true
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ use super::list_commands;
14
14
use crate :: command_prelude:: * ;
15
15
use crate :: util:: is_rustup;
16
16
use cargo:: core:: features:: HIDDEN ;
17
+ use cargo:: util:: style;
17
18
18
19
pub fn main ( config : & mut LazyConfig ) -> CliResult {
19
20
let args = cli ( ) . try_get_matches ( ) ?;
@@ -519,15 +520,14 @@ pub fn cli() -> Command {
519
520
} ;
520
521
521
522
let styles = {
522
- use clap:: builder:: styling:: * ;
523
- Styles :: styled ( )
524
- . header ( AnsiColor :: Green . on_default ( ) | Effects :: BOLD )
525
- . usage ( AnsiColor :: Green . on_default ( ) | Effects :: BOLD )
526
- . literal ( AnsiColor :: Cyan . on_default ( ) | Effects :: BOLD )
527
- . placeholder ( AnsiColor :: Cyan . on_default ( ) )
528
- . error ( AnsiColor :: Red . on_default ( ) | Effects :: BOLD )
529
- . valid ( AnsiColor :: Cyan . on_default ( ) | Effects :: BOLD )
530
- . invalid ( AnsiColor :: Yellow . on_default ( ) | Effects :: BOLD )
523
+ clap:: builder:: styling:: Styles :: styled ( )
524
+ . header ( style:: HEADER )
525
+ . usage ( style:: USAGE )
526
+ . literal ( style:: LITERAL )
527
+ . placeholder ( style:: PLACEHOLDER )
528
+ . error ( style:: ERROR )
529
+ . valid ( style:: VALID )
530
+ . invalid ( style:: INVALID )
531
531
} ;
532
532
533
533
Command :: new ( "cargo" )
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ mod queue;
60
60
pub mod restricted_names;
61
61
pub mod rustc;
62
62
mod semver_ext;
63
+ pub mod style;
63
64
pub mod to_semver;
64
65
pub mod toml;
65
66
pub mod toml_mut;
Original file line number Diff line number Diff line change
1
+ use anstyle:: * ;
2
+
3
+ pub const HEADER : Style = AnsiColor :: Green . on_default ( ) . effects ( Effects :: BOLD ) ;
4
+ pub const USAGE : Style = AnsiColor :: Green . on_default ( ) . effects ( Effects :: BOLD ) ;
5
+ pub const LITERAL : Style = AnsiColor :: Cyan . on_default ( ) . effects ( Effects :: BOLD ) ;
6
+ pub const PLACEHOLDER : Style = AnsiColor :: Cyan . on_default ( ) ;
7
+ pub const ERROR : Style = AnsiColor :: Red . on_default ( ) . effects ( Effects :: BOLD ) ;
8
+ pub const VALID : Style = AnsiColor :: Cyan . on_default ( ) . effects ( Effects :: BOLD ) ;
9
+ pub const INVALID : Style = AnsiColor :: Yellow . on_default ( ) . effects ( Effects :: BOLD ) ;
You can’t perform that action at this time.
0 commit comments