Skip to content

Commit ab8a857

Browse files
committed
move default conf & prefs into resource files
This makes it comre convenient to edit them when they're not in strings in rust files.
1 parent eec6cb8 commit ab8a857

File tree

5 files changed

+10
-14
lines changed

5 files changed

+10
-14
lines changed

src/default_package_config.rs renamed to defaults/default-bacon.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
pub static DEFAULT_PACKAGE_CONFIG: &str = r#"
21
# This is a configuration file for the bacon tool
32
# More info at https://github.com/Canop/bacon
43

@@ -23,5 +22,3 @@ need_stdout = false
2322
command = ["cargo", "test", "--color", "always"]
2423
need_stdout = true
2524
watch = ["tests"]
26-
27-
"#;

src/default_prefs.rs renamed to defaults/default-prefs.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
pub static DEFAULT_PREFS: &str = r#"
21
# This is a preferences file for the bacon tool
32
# More info at https://github.com/Canop/bacon
43

@@ -21,5 +20,3 @@ pub static DEFAULT_PREFS: &str = r#"
2120
# with g, G, j, k
2221
#
2322
# vim_keys = true
24-
25-
"#;

src/defaults.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
pub static DEFAULT_PREFS: &str = include_str!("../defaults/default-prefs.toml");
3+
4+
pub static DEFAULT_PACKAGE_CONFIG: &str = include_str!("../defaults/default-bacon.toml");
5+

src/drawing.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use {
22
crate::*,
33
anyhow::*,
44
crossterm::{cursor, execute, terminal},
5-
std::io::Write,
65
};
76

87
pub fn goto(w: &mut W, y: u16) -> Result<()> {

src/main.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ mod args;
33
mod cli;
44
mod command_output;
55
mod command_result;
6-
mod default_package_config;
7-
mod default_prefs;
6+
mod defaults;
87
mod drawing;
98
mod executor;
109
mod failure;
@@ -29,8 +28,7 @@ pub use {
2928
cli::*,
3029
command_output::*,
3130
command_result::*,
32-
default_package_config::*,
33-
default_prefs::*,
31+
defaults::*,
3432
drawing::*,
3533
executor::*,
3634
failure::*,
@@ -50,12 +48,12 @@ pub use {
5048
wrap::*,
5149
};
5250

53-
#[macro_use]
54-
extern crate log;
51+
#[macro_use] extern crate log;
52+
#[macro_use] extern crate cli_log;
5553

5654
/// Knowledge is power
5755
fn main() -> anyhow::Result<()> {
58-
cli_log::init("bacon");
56+
init_cli_log!();
5957
cli::run()?;
6058
info!("bye");
6159
Ok(())

0 commit comments

Comments
 (0)