Merge pull request #1228 from matthiasbeyer/imag-view/view-content-by-default

Show content by default
This commit is contained in:
Matthias Beyer 2018-02-01 22:53:47 +01:00 committed by GitHub
commit 1d4015dc9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View file

@ -71,7 +71,7 @@ fn main() {
let entry_id = rt.cli().value_of("id").unwrap(); // enforced by clap let entry_id = rt.cli().value_of("id").unwrap(); // enforced by clap
let view_header = rt.cli().is_present("view-header"); 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)) { let entry = match rt.store().get(PathBuf::from(entry_id)) {
Ok(Some(fle)) => fle, Ok(Some(fle)) => fle,
@ -123,7 +123,7 @@ fn main() {
.map_err_trace_exit_unwrap(1); .map_err_trace_exit_unwrap(1);
} }
if view_content { if !hide_content {
let _ = tmpfile.write(entry.get_content().as_bytes()) let _ = tmpfile.write(entry.get_content().as_bytes())
.map_err_trace_exit_unwrap(1); .map_err_trace_exit_unwrap(1);
} }
@ -161,7 +161,7 @@ fn main() {
exit(1) exit(1)
} }
} else { } else {
let _ = StdoutViewer::new(view_header, view_content) let _ = StdoutViewer::new(view_header, !hide_content)
.view_entry(&entry) .view_entry(&entry)
.map_err_trace_exit_unwrap(1); .map_err_trace_exit_unwrap(1);
} }

View file

@ -34,12 +34,12 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.takes_value(false) .takes_value(false)
.required(false) .required(false)
.help("View header")) .help("View header"))
.arg(Arg::with_name("view-content") .arg(Arg::with_name("not-view-content")
.long("content") .long("no-content")
.short("C") .short("C")
.takes_value(false) .takes_value(false)
.required(false) .required(false)
.help("View content")) .help("Do not view content"))
.arg(Arg::with_name("in") .arg(Arg::with_name("in")
.long("in") .long("in")

View file

@ -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 * 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()` was removed in favour of
`ResultExt::map_err_trace_exit_unwrap()`. `ResultExt::map_err_trace_exit_unwrap()`.
* `imag-view` shows content by default now. Use `-C` to hide the content.
* Bugfixes * Bugfixes
* `libimagbookmark` contained a type which wrapped a `FileLockEntry` from * `libimagbookmark` contained a type which wrapped a `FileLockEntry` from
`libimagstore`. This was considered a bug and was fixed. `libimagstore`. This was considered a bug and was fixed.