on master help sign in
Fix accidental printing of files named 'cache'
7215229sharkdp
Cargo.lock+2
@@ -1,3 +1,5 @@
1+# This file is automatically @generated by Cargo.
2+# It is not intended for manual editing.
1[[package]]
3[[package]]
2name = "adler32"
4name = "adler32"
3version = "1.0.3"
5version = "1.0.3"
src/clap_app.rs−1
@@ -18,7 +18,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
18 .global_setting(AppSettings::DeriveDisplayOrder)
18 .global_setting(AppSettings::DeriveDisplayOrder)
19 .global_setting(AppSettings::UnifiedHelpMessage)
19 .global_setting(AppSettings::UnifiedHelpMessage)
20 .global_setting(AppSettings::HidePossibleValuesInHelp)
20 .global_setting(AppSettings::HidePossibleValuesInHelp)
21− .setting(AppSettings::InferSubcommands)
22 .setting(AppSettings::ArgsNegateSubcommands)
21 .setting(AppSettings::ArgsNegateSubcommands)
23 .setting(AppSettings::DisableHelpSubcommand)
22 .setting(AppSettings::DisableHelpSubcommand)
24 .setting(AppSettings::VersionlessSubcommands)
23 .setting(AppSettings::VersionlessSubcommands)
tests/examples/cachenew file+1
@@ -0,0 +1 @@
1+test
tests/integration_tests.rs+15
@@ -448,3 +448,18 @@ fn utf16() {
448 .success()
448 .success()
449 .stdout(std::str::from_utf8(b"\xEF\xBB\xBFhello world\n").unwrap());
449 .stdout(std::str::from_utf8(b"\xEF\xBB\xBFhello world\n").unwrap());
450}
450}
451+
452+#[test]
453+fn can_print_file_named_cache() {
454+ bat()
455+ .arg("cache")
456+ .assert()
457+ .success()
458+ .stdout("test\n")
459+ .stderr("");
460+}
461+
462+#[test]
463+fn does_not_print_unwanted_file_named_cache() {
464+ bat_with_config().arg("cach").assert().failure();
465+}