diff options
author | Cyborus <cyborus@noreply.codeberg.org> | 2024-06-10 19:30:13 +0200 |
---|---|---|
committer | Cyborus <cyborus@noreply.codeberg.org> | 2024-06-10 19:30:13 +0200 |
commit | a0c250f1f1e85dcbd27a48aaecddaee7c819e0d6 (patch) | |
tree | 441a7d744392338e8c6de716d5718031996580fd | |
parent | Merge pull request 'print markdown text nicely' (#75) from pretty-text into main (diff) | |
parent | fix warnings (diff) | |
download | forgejo-cli-a0c250f1f1e85dcbd27a48aaecddaee7c819e0d6.tar.xz forgejo-cli-a0c250f1f1e85dcbd27a48aaecddaee7c819e0d6.zip |
Merge pull request 'fix warnings' (#76) from warnings into main
Reviewed-on: https://codeberg.org/Cyborus/forgejo-cli/pulls/76
-rw-r--r-- | src/auth.rs | 1 | ||||
-rw-r--r-- | src/issues.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 68 | ||||
-rw-r--r-- | src/prs.rs | 3 | ||||
-rw-r--r-- | src/repo.rs | 2 |
5 files changed, 37 insertions, 39 deletions
diff --git a/src/auth.rs b/src/auth.rs index dfc8865..d86325f 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -225,7 +225,6 @@ fn auth_server() -> ( .await .unwrap(); } - Ok(()) }); (handle, rx) } diff --git a/src/issues.rs b/src/issues.rs index 233d603..c2fbac7 100644 --- a/src/issues.rs +++ b/src/issues.rs @@ -178,7 +178,7 @@ impl IssueCommand { fn no_repo_error(&self) -> eyre::Error { use IssueSubcommand::*; match &self.command { - Create { repo, .. } | Search { repo, .. } => { + Create { .. } | Search { .. } => { eyre::eyre!("can't figure what repo to access, try specifying with `--repo`") } View { id: issue, .. } diff --git a/src/main.rs b/src/main.rs index 6bd8a45..ff20789 100644 --- a/src/main.rs +++ b/src/main.rs @@ -174,17 +174,18 @@ struct SpecialRender { body_prefix: char, horiz_rule: char, - red: &'static str, + // Uncomment these as needed + // red: &'static str, bright_red: &'static str, - green: &'static str, + // green: &'static str, bright_green: &'static str, - blue: &'static str, + // blue: &'static str, bright_blue: &'static str, - cyan: &'static str, - bright_cyan: &'static str, + // cyan: &'static str, + // bright_cyan: &'static str, yellow: &'static str, - bright_yellow: &'static str, - magenta: &'static str, + // bright_yellow: &'static str, + // magenta: &'static str, bright_magenta: &'static str, black: &'static str, dark_grey: &'static str, @@ -194,8 +195,7 @@ struct SpecialRender { reset: &'static str, dark_grey_bg: &'static str, - no_bg: &'static str, - + // no_bg: &'static str, hide_cursor: &'static str, show_cursor: &'static str, clear_line: &'static str, @@ -226,17 +226,17 @@ impl SpecialRender { body_prefix: '▌', horiz_rule: '─', - red: "\x1b[31m", + // red: "\x1b[31m", bright_red: "\x1b[91m", - green: "\x1b[32m", + // green: "\x1b[32m", bright_green: "\x1b[92m", - blue: "\x1b[34m", + // blue: "\x1b[34m", bright_blue: "\x1b[94m", - cyan: "\x1b[36m", - bright_cyan: "\x1b[96m", + // cyan: "\x1b[36m", + // bright_cyan: "\x1b[96m", yellow: "\x1b[33m", - bright_yellow: "\x1b[93m", - magenta: "\x1b[35m", + // bright_yellow: "\x1b[93m", + // magenta: "\x1b[35m", bright_magenta: "\x1b[95m", black: "\x1b[30m", dark_grey: "\x1b[90m", @@ -246,8 +246,7 @@ impl SpecialRender { reset: "\x1b[0m", dark_grey_bg: "\x1b[100m", - no_bg: "\x1b[49", - + // no_bg: "\x1b[49", hide_cursor: "\x1b[?25l", show_cursor: "\x1b[?25h", clear_line: "\x1b[2K", @@ -269,17 +268,17 @@ impl SpecialRender { body_prefix: '>', horiz_rule: '-', - red: "", + // red: "", bright_red: "", - green: "", + // green: "", bright_green: "", - blue: "", + // blue: "", bright_blue: "", - cyan: "", - bright_cyan: "", + // cyan: "", + // bright_cyan: "", yellow: "", - bright_yellow: "", - magenta: "", + // bright_yellow: "", + // magenta: "", bright_magenta: "", black: "", dark_grey: "", @@ -289,8 +288,7 @@ impl SpecialRender { reset: "", dark_grey_bg: "", - no_bg: "", - + // no_bg: "", hide_cursor: "", show_cursor: "", clear_line: "", @@ -583,9 +581,10 @@ impl AnsiPrinter { } } - fn current_fg(&self) -> Option<&'static str> { - self.current_style().fg - } + // Uncomment if needed + // fn current_fg(&self) -> Option<&'static str> { + // self.current_style().fg + // } fn start_fg(&mut self, color: &'static str) { self.current_style_mut().fg = Some(color); @@ -606,10 +605,11 @@ impl AnsiPrinter { self.out.push_str(color); } - fn stop_bg(&mut self) { - self.current_style_mut().bg = None; - self.out.push_str(self.special_render.no_bg); - } + // Uncomment if needed + // fn stop_bg(&mut self) { + // self.current_style_mut().bg = None; + // self.out.push_str(self.special_render.no_bg); + // } fn is_bold(&self) -> bool { self.current_style().bold @@ -527,7 +527,6 @@ async fn view_pr_labels(repo: &RepoName, api: &Forgejo, pr: Option<u64>) -> eyre let (category, name) = name .split_once("/") .ok_or_eyre("label is exclusive but does not have slash")?; - let rgb_fg = format!("\x1b[38;2;{r};{g};{b}m"); let rgb_bg_dark = format!("\x1b[48;2;{r2};{g2};{b2}m"); print!("{rgb_bg_dark}{text_color} {category} {rgb_bg} {name} {reset} "); } else { @@ -985,7 +984,7 @@ async fn view_pr_files(repo: &RepoName, api: &Forgejo, pr: Option<u64>) -> eyre: limit: Some(u32::MAX), ..Default::default() }; - let (headers, files) = api + let (_, files) = api .repo_get_pull_request_files(repo.owner(), repo.name(), pr, query) .await?; let max_additions = files diff --git a/src/repo.rs b/src/repo.rs index 33befec..e97ecb4 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -476,7 +476,7 @@ impl RepoCommand { let path = path.unwrap_or_else(|| PathBuf::from(format!("./{repo_name}"))); let SpecialRender { - fancy, // actually using it to indicate fanciness FIXME + fancy, hide_cursor, show_cursor, clear_line, |