Skip to content

Commit

Permalink
πŸ“‰ Remove new lines from description output
Browse files Browse the repository at this point in the history
Closes #71

Matches the behaviour of track.toggl.com, on editing time-entry
descriptions with newlines, they get converted to spaces instead.

Try the patch with a multiline time-entry description.
eg.

  $ toggl start "(ls -l)"

  -rw-r--r--@  1 shantanu  staff  73198 Dec 17 03:33 Cargo.lock
  -rw-r--r--@  1 shantanu  staff   1205 Dec 17 03:33 Cargo.toml
  -rw-r--r--@  1 shantanu  staff   1074 Mar 25  2023 LICENSE.md
  -rw-r--r--@  1 shantanu  staff   3494 Dec 17 03:33 README.md
  drwxr-xr-x@  4 shantanu  staff    128 Dec 17 03:12 pkg
  -rw-r--r--@  1 shantanu  staff    197 Dec 12 20:00 rust-toolchain.toml
  drwxr-xr-x@ 13 shantanu  staff    416 Dec 22 20:25 src
  drwxr-xr-x@  9 shantanu  staff    288 Dec 17 01:50 target'`
  Time entry started
    [0:00:00]* –  total 176 -rw-r--r--@  1 shantanu  staff  73198 Dec 17 03:33 Cargo.lock -rw-r--r--@  1 shantanu  staff   1205 Dec 17 03:33 Cargo.toml -rw-r--r--@  1 shantanu  staff   1074 Mar 25  2023 LICENSE.md -rw-r--r--@  1 shantanu  staff   3494 Dec 17 03:33 README.md drwxr-xr-x@  4 shantanu  staff    128 Dec 17 03:12 pkg -rw-r--r--@  1 shantanu  staff    197 Dec 12 20:00 rust-toolchain.toml drwxr-xr-x@ 13 shantanu  staff    416 Dec 22 20:25 src drwxr-xr-x@  9 shantanu  staff    288 Dec 17 01:50 target @watercooler-labs #[code, toggl-cli]

As a follow up task we can trim the output to sensible default.
  • Loading branch information
shantanuraj committed Dec 22, 2023
1 parent 811db24 commit 01fea9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl std::fmt::Display for TimeEntry {
self.get_duration_hmmss().normal()
},
if self.is_running() { "*" } else { " " },
self.get_description(),
self.get_description().replace('\n', " "),
match self.project.clone() {
Some(p) => format!(" @{}", p),
None => "".to_string(),
Expand Down

0 comments on commit 01fea9b

Please sign in to comment.