Skip to content

Commit 2882ed7

Browse files
committed
Update and fix #152
1 parent 0f8f226 commit 2882ed7

File tree

4 files changed

+34
-29
lines changed

4 files changed

+34
-29
lines changed

Cargo.toml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,58 +17,58 @@ exclude = [
1717

1818
[dependencies]
1919
# Argument parsing
20-
clap = { version = "4.2.4", features = ["derive"] }
21-
clap_complete = "4.2.1"
20+
clap = { version = "4.4.11", features = ["derive"] }
21+
clap_complete = "4.4.4"
2222

2323
# Configuration management
2424
confy = "0.5.1"
2525
directories-next = "1.0.2"
2626

2727
# Error management
28-
eyre = "0.6.8"
28+
eyre = "0.6.11"
2929
color-eyre = { version = "0.6.2", default-features = false }
30-
thiserror = "1.0.40"
30+
thiserror = "1.0.52"
3131

3232
# Database related
3333
sled = "0.34.7"
3434
bincode = "1.3.3"
3535

3636
# Serializing
37-
serde = "1.0.160"
38-
serde_json = "1.0.96"
39-
serde_derive = "1.0.160"
40-
serde_yaml = "0.9.21"
37+
serde = "1.0.193"
38+
serde_json = "1.0.108"
39+
serde_derive = "1.0.193"
40+
serde_yaml = "0.9.29"
4141

4242
# Parsing and manipulating dates
43-
chrono = { version = "0.4.24", features = ["serde"] }
43+
chrono = { version = "0.4.31", features = ["serde"] }
4444
chrono-english = "0.1.7"
4545

4646
# Taking user input and showing progress
47-
dialoguer = {version = "0.11.0", features = ["completion", "history", "fuzzy-select"]}
48-
indicatif = "0.17.3"
47+
dialoguer = { version = "0.11.0", features = ["completion", "history", "fuzzy-select"] }
48+
indicatif = "0.17.7"
4949

5050
# Fuzzy search
5151
skim = "0.10.4"
5252

5353
# Terminal syntax highlighting
54-
syntect = { version = "5.0.0", default-features = false, features = ["default-fancy"] }
54+
syntect = { version = "5.1.0", default-features = false, features = ["default-fancy"] }
5555
hex = "0.4.3"
56-
grep-cli = "0.1.7"
57-
termcolor = "1.2.0"
56+
grep-cli = "0.1.10"
57+
termcolor = "1.4.0"
5858

5959
# Sync to Gist/GitLab
60-
ureq = { version = "2.6.2", features = ["json"] }
60+
ureq = { version = "2.9.1", features = ["json"] }
6161
strum = "0.25.0"
6262
strum_macros = "0.25.3"
6363

6464
# pattern filter and filling shell script variables
65-
regex = "1.8.1"
65+
regex = "1.10.2"
6666

6767
[dev-dependencies]
68-
assert_cmd = "2.0.11"
69-
predicates = "3.0.3"
70-
tempfile = "3.5.0"
71-
expectrl = "0.7.0"
68+
assert_cmd = "2.0.12"
69+
predicates = "3.0.4"
70+
tempfile = "3.8.1"
71+
expectrl = "0.7.1"
7272

7373
[target.'cfg(target_os = "macos")'.dev-dependencies]
7474
clipboard = "0.5.0"

src/errors.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ pub enum LostTheWay {
2626
#[error("ThemeError: {theme:?}")]
2727
ThemeError { theme: String },
2828
/// Thrown when trying to load a syntax which hasn't been added / doesn't exist
29-
#[error("SyntaxError: {syntax:?}")]
30-
SyntaxError { syntax: String },
29+
#[error("SyntaxError: {message:?} {syntax_file:?}")]
30+
SyntaxError {
31+
syntax_file: String,
32+
message: String,
33+
},
3134
/// Thrown when there's an error while trying to access system clipboard
3235
#[error("ClipboardError: Couldn't copy to clipboard - {message}")]
3336
ClipboardError { message: String },

src/language.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,9 @@ impl CodeHighlight {
308308
true,
309309
None,
310310
)
311-
.map_err(|_e| LostTheWay::SyntaxError {
312-
syntax: syntax_file.to_str().unwrap().into(),
311+
.map_err(|e| LostTheWay::SyntaxError {
312+
syntax_file: syntax_file.to_str().unwrap().into(),
313+
message: e.to_string(),
313314
})
314315
.suggestion(format!(
315316
"Couldn't load a syntax from {}, are you sure this is a valid .sublime-syntax file with a \'name\' key?",
@@ -319,7 +320,8 @@ impl CodeHighlight {
319320
.file_name()
320321
.and_then(std::ffi::OsStr::to_str)
321322
.ok_or(LostTheWay::SyntaxError {
322-
syntax: syntax_file.to_str().unwrap().into(),
323+
syntax_file: syntax_file.to_str().unwrap().into(),
324+
message: String::from("Filename is not valid Unicode"),
323325
})
324326
.suggestion("Something's fishy with the filename, valid Unicode?")?;
325327
// Copy syntax file to syntect dir

src/utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::collections::HashSet;
2-
use std::io::Write;
2+
use std::io::{IsTerminal, Write};
33
use std::process::{Command, Stdio};
44
use std::str;
55

@@ -140,13 +140,13 @@ pub fn parse_date(date_string: &str) -> color_eyre::Result<DateTime<Utc>> {
140140
/// Some(date) => date
141141
/// None => minimum possible date
142142
pub fn date_start(from_date: Option<DateTime<Utc>>) -> DateTime<Utc> {
143-
from_date.unwrap_or_else(|| DateTime::from_utc(NaiveDateTime::MIN, Utc))
143+
from_date.unwrap_or_else(|| DateTime::from_naive_utc_and_offset(NaiveDateTime::MIN, Utc))
144144
}
145145

146146
/// Some(date) => date
147147
/// None => maximum possible date
148148
pub fn date_end(to_date: Option<DateTime<Utc>>) -> DateTime<Utc> {
149-
to_date.unwrap_or_else(|| DateTime::from_utc(NaiveDateTime::MAX, Utc))
149+
to_date.unwrap_or_else(|| DateTime::from_naive_utc_and_offset(NaiveDateTime::MAX, Utc))
150150
}
151151

152152
/// Gets input from external editor, optionally displays default text in editor
@@ -247,7 +247,7 @@ pub fn smart_print(
247247
write!(
248248
grep_cli::stdout(termcolor::ColorChoice::Auto),
249249
"{}",
250-
if !plain & (grep_cli::is_tty_stdout() | colorize) {
250+
if !plain & (std::io::stdout().is_terminal() | colorize) {
251251
highlight_strings(inputs, bg)
252252
} else {
253253
inputs

0 commit comments

Comments
 (0)