Skip to content

Commit 31d5427

Browse files
author
Marek Suchánek
committed
Enable the --detect-directory option by default; Issue #16
1 parent 14a4b86 commit 31d5427

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ The `newdoc` tool generates pre-populated module and assembly files formatted wi
115115
116116
This creates the two modules and an assembly that features the include statements for the modules.
117117
118-
* To let `newdoc` automatically fill out the include path, add the `--detect-directory` or `-D` option. Otherwise, `newdoc` uses the `<path>` placeholder in generated include statements.
119-
120118
121119
## Packaging and distributing newdoc as an RPM
122120

src/cmd_line.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ pub fn get_args() -> ArgMatches<'static> {
8383
Arg::with_name("detect-directory")
8484
.short("D")
8585
.long("detect-directory")
86-
.help("Detect the include path, rather than using the <path> placeholder"),
86+
.help("Detect the include path, rather than using the <path> placeholder. This is now the default behavior")
87+
// I'm enabling this option by default, without a way to disable it.
88+
// Let the users test the new behavior and evaluate.
89+
.hidden(true),
8790
)
8891
.arg(
8992
Arg::with_name("no-prefixes")

src/main.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ pub struct Options {
1818
fn main() {
1919
let cmdline_args = cmd_line::get_args();
2020

21+
if cmdline_args.is_present("detect-directory") {
22+
eprintln!("I: The `--detect-directory` (`-D`) option is now enabled by default.");
23+
}
24+
2125
// Set current options based on the command-line options
2226
let options = Options {
2327
// Comments and prefixes are enabled (true) by default unless you disable them
@@ -32,7 +36,12 @@ fn main() {
3236
} else {
3337
String::from(".")
3438
},
35-
detect_directory: cmdline_args.is_present("detect-directory"),
39+
// I'm turning this into the default behavior.
40+
// For now, I'm goin to keep the switch as is, just always true,
41+
// So that I can easily revert the changes later if needed.
42+
// After this change has had proper user testing, let's remove the switch
43+
// and the dead code.
44+
detect_directory: true,
3645
};
3746

3847
// Store all modules except for the populated assembly that will be created in this Vec

0 commit comments

Comments
 (0)