summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-02-01 22:53:47 +0100
committerGitHub <noreply@github.com>2018-02-01 22:53:47 +0100
commit1d4015dc9c5b9d3a761f62b1efe319f484b77259 (patch)
treea95c3a2d2e575623474d40a58d00722f76896cf0
parentde613c9ebd6ec0e35b3b90159232cd8229aa4a3b (diff)
parentae4ced9587277f1fe68ea08a7afa21ab8ae4c657 (diff)
downloadimag-1d4015dc9c5b9d3a761f62b1efe319f484b77259.zip
imag-1d4015dc9c5b9d3a761f62b1efe319f484b77259.tar.gz
Merge pull request #1228 from matthiasbeyer/imag-view/view-content-by-default
Show content by default
-rw-r--r--bin/core/imag-view/src/main.rs6
-rw-r--r--bin/core/imag-view/src/ui.rs6
-rw-r--r--doc/src/09020-changelog.md1
3 files changed, 7 insertions, 6 deletions
diff --git a/bin/core/imag-view/src/main.rs b/bin/core/imag-view/src/main.rs
index eba2245..fa13447 100644
--- a/bin/core/imag-view/src/main.rs
+++ b/bin/core/imag-view/src/main.rs
@@ -71,7 +71,7 @@ fn main() {
let entry_id = rt.cli().value_of("id").unwrap(); // enforced by clap
let view_header = rt.cli().is_present("view-header");
- let view_content = rt.cli().is_present("view-content");
+ let hide_content = rt.cli().is_present("not-view-content");
let entry = match rt.store().get(PathBuf::from(entry_id)) {
Ok(Some(fle)) => fle,
@@ -123,7 +123,7 @@ fn main() {
.map_err_trace_exit_unwrap(1);
}
- if view_content {
+ if !hide_content {
let _ = tmpfile.write(entry.get_content().as_bytes())
.map_err_trace_exit_unwrap(1);
}
@@ -161,7 +161,7 @@ fn main() {
exit(1)
}
} else {
- let _ = StdoutViewer::new(view_header, view_content)
+ let _ = StdoutViewer::new(view_header, !hide_content)
.view_entry(&entry)
.map_err_trace_exit_unwrap(1);
}
diff --git a/bin/core/imag-view/src/ui.rs b/bin/core/imag-view/src/ui.rs
index cde0601..e9cbe96 100644
--- a/bin/core/imag-view/src/ui.rs
+++ b/bin/core/imag-view/src/ui.rs
@@ -34,12 +34,12 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.takes_value(false)
.required(false)
.help("View header"))
- .arg(Arg::with_name("view-content")
- .long("content")
+ .arg(Arg::with_name("not-view-content")
+ .long("no-content")
.short("C")
.takes_value(false)
.required(false)
- .help("View content"))
+ .help("Do not view content"))
.arg(Arg::with_name("in")
.long("in")
diff --git a/doc/src/09020-changelog.md b/doc/src/09020-changelog.md
index 6a848e1..7d59b06 100644
--- a/doc/src/09020-changelog.md
+++ b/doc/src/09020-changelog.md
@@ -41,6 +41,7 @@ This section contains the changelog from the last release to the next release.
* The `toml-query` dependency was updated to 0.6.0
* `ResultExt::map_err_trace_exit()` was removed in favour of
`ResultExt::map_err_trace_exit_unwrap()`.
+ * `imag-view` shows content by default now. Use `-C` to hide the content.
* Bugfixes
* `libimagbookmark` contained a type which wrapped a `FileLockEntry` from
`libimagstore`. This was considered a bug and was fixed.