Prechádzať zdrojové kódy

[Build] Features selection errors fixed

Signed-off-by: Slava Barinov <rayslava@gmail.com>
Slava Barinov 4 rokov pred
rodič
commit
f0d7b95886
2 zmenil súbory, kde vykonal 15 pridanie a 6 odobranie
  1. 2 0
      src/convert.rs
  2. 13 6
      src/main.rs

+ 2 - 0
src/convert.rs

@@ -1,3 +1,4 @@
+#[cfg(feature = "telegram")]
 use crate::categories::get_top_category;
 use crate::categories::CatStats;
 use crate::receipt;
@@ -78,6 +79,7 @@ pub fn gen_trans<'a>(
 }
 
 /// Check if all items in `filename` do have a category assigned by `user`
+#[cfg(feature = "telegram")]
 pub fn non_cat_items(filename: &str, user: &User) -> Vec<String> {
     let file = read_file(filename);
     let mut result: Vec<String> = Vec::new();

+ 13 - 6
src/main.rs

@@ -25,11 +25,17 @@ struct Cli {
     memo: String,
 
     /// Run telegram bot
+    #[cfg(feature = "telegram")]
     #[structopt(short, long)]
     telegram: bool,
 
+    /// Run Turbo Vision UI
+    #[cfg(feature = "tv")]
+    #[structopt(long)]
+    ui: bool,
+
     /// The path to the file to read
-    #[structopt(required_unless = "telegram")]
+    #[structopt(required_unless_one = &["telegram", "ui"])]
     filename: Option<String>,
 }
 
@@ -50,6 +56,12 @@ fn main() {
         Some(path) => user.accounts(import::read_accounts(&path).unwrap()),
     }
 
+    #[cfg(feature = "tv")]
+    {
+        ui::run_tv();
+        return;
+    }
+
     // If program is used as command-line tool
     let acc = Account::new()
         .name("Wallet")
@@ -64,9 +76,4 @@ fn main() {
         print!("{}", acc.to_string());
         println!("{}", t.to_string());
     }
-
-    #[cfg(feature = "tv")]
-    {
-        ui::run_tv();
-    }
 }