File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ pub enum Commands {
1515 Scan ,
1616 /// Clean all build artifacts in the current directory
1717 Clean ,
18+ /// Show all built-in artifact types
19+ ArtifactTypes ,
1820}
1921
2022#[ cfg( test) ]
Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ fn main() {
2525 Err ( err) => exit_unrecoverable ( err) ,
2626 Ok ( _) => { }
2727 } ,
28+ Commands :: ArtifactTypes => match artifact_types ( ) {
29+ Err ( err) => exit_unrecoverable ( err) ,
30+ Ok ( _) => { }
31+ } ,
2832 }
2933}
3034
@@ -138,6 +142,17 @@ fn clean() -> io::Result<()> {
138142 }
139143}
140144
145+ fn artifact_types ( ) -> io:: Result < ( ) > {
146+ let term = Term :: stdout ( ) ;
147+ term. write_line ( "Built-in artifact types supported by crufty:" ) ?;
148+ for ( i, artifact) in artifact_type:: builtin ( ) . iter_mut ( ) . enumerate ( ) {
149+ term. write_line ( & format ! ( "[{}] {}" , i + 1 , artifact. artifact_type_name( ) ) ) ?;
150+ term. write_line ( & format ! ( " - Matches: {}" , artifact. pattern( ) ) ) ?;
151+ term. write_line ( & format ! ( " - Recognized by: {}" , artifact. recognized_files( ) . join( ", " ) ) ) ?;
152+ }
153+ Ok ( ( ) )
154+ }
155+
141156fn exit_unrecoverable ( _err : io:: Error ) {
142157 let term_err = Term :: stderr ( ) ;
143158 let error_message = "Encountered error, existing..." ;
You can’t perform that action at this time.
0 commit comments