@@ -46,17 +46,18 @@ impl DeployerProjectOptions {
4646 println ! ( "{}" , i18n:: PROJECT_SPECIFY_PLS ) ;
4747 self . langs = specify_programming_languages ( ) ?;
4848 for lang in & self . langs {
49- match lang {
50- ProgrammingLanguage :: Rust => self
49+ let ProgrammingLanguage ( lang) = lang;
50+ match lang. as_str ( ) {
51+ "rust" => self
5152 . cache_files
5253 . extend ( [ PathBuf :: from ( "Cargo.lock" ) , PathBuf :: from ( "target" ) ] . into_iter ( ) ) ,
53- ProgrammingLanguage :: Go => self
54+ "go" => self
5455 . cache_files
5556 . extend ( [ PathBuf :: from ( "go.sum" ) , PathBuf :: from ( "vendor" ) ] . into_iter ( ) ) ,
56- ProgrammingLanguage :: Python => self
57+ "python" => self
5758 . cache_files
5859 . extend ( [ PathBuf :: from ( "__pycache__" ) , PathBuf :: from ( "dist" ) ] . into_iter ( ) ) ,
59- ProgrammingLanguage :: C | ProgrammingLanguage :: Cpp => self
60+ "c" | "cpp" => self
6061 . cache_files
6162 . extend ( [ PathBuf :: from ( "CMakeFiles" ) , PathBuf :: from ( "CMakeCache.txt" ) ] . into_iter ( ) ) ,
6263 _ => { }
@@ -990,12 +991,12 @@ impl ProgrammingLanguage {
990991 pub fn new_from_prompt ( ) -> anyhow:: Result < Self > {
991992 let s = inquire:: Text :: new ( i18n:: PL_INPUT_PROMPT ) . prompt ( ) ?;
992993 let pl = match s. as_str ( ) {
993- "Rust" => Self :: Rust ,
994- "Go" => Self :: Go ,
995- "C" => Self :: C ,
996- "C++" => Self :: Cpp ,
997- "Python" => Self :: Python ,
998- s => Self :: Other ( s. to_owned ( ) ) ,
994+ "Rust" => Self ( "rust" . to_string ( ) ) ,
995+ "Go" => Self ( "go" . to_string ( ) ) ,
996+ "C" => Self ( "c" . to_string ( ) ) ,
997+ "C++" => Self ( "cpp" . to_string ( ) ) ,
998+ "Python" => Self ( "python" . to_string ( ) ) ,
999+ s => Self ( s. to_string ( ) ) ,
9991000 } ;
10001001 Ok ( pl)
10011002 }
@@ -1011,11 +1012,11 @@ pub fn specify_programming_languages() -> anyhow::Result<Vec<ProgrammingLanguage
10111012 let mut result = Vec :: new ( ) ;
10121013 for lang in selected {
10131014 let lang = match lang {
1014- "Rust" => ProgrammingLanguage :: Rust ,
1015- "Go" => ProgrammingLanguage :: Go ,
1016- "C" => ProgrammingLanguage :: C ,
1017- "C++" => ProgrammingLanguage :: Cpp ,
1018- "Python" => ProgrammingLanguage :: Python ,
1015+ "Rust" => ProgrammingLanguage ( "rust" . to_string ( ) ) ,
1016+ "Go" => ProgrammingLanguage ( "go" . to_string ( ) ) ,
1017+ "C" => ProgrammingLanguage ( "c" . to_string ( ) ) ,
1018+ "C++" => ProgrammingLanguage ( "cpp" . to_string ( ) ) ,
1019+ "Python" => ProgrammingLanguage ( "python" . to_string ( ) ) ,
10191020 "Others" => {
10201021 let langs = collect_multiple_languages ( ) ?;
10211022 result. extend_from_slice ( & langs) ;
@@ -1037,7 +1038,7 @@ fn collect_multiple_languages() -> anyhow::Result<Vec<ProgrammingLanguage>> {
10371038 for lang in langs {
10381039 match lang. as_str ( ) {
10391040 "Rust" | "Go" | "C" | "C++" | "Python" => continue ,
1040- lang => v. push ( ProgrammingLanguage :: Other ( lang. to_owned ( ) ) ) ,
1041+ lang => v. push ( ProgrammingLanguage ( lang. to_string ( ) ) ) ,
10411042 }
10421043 }
10431044
0 commit comments