mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-10 12:09:33 +01:00
fix warnings
This commit is contained in:
parent
d10b5172be
commit
09af9b3023
5 changed files with 37 additions and 39 deletions
|
@ -225,7 +225,6 @@ fn auth_server() -> (
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
});
|
});
|
||||||
(handle, rx)
|
(handle, rx)
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ impl IssueCommand {
|
||||||
fn no_repo_error(&self) -> eyre::Error {
|
fn no_repo_error(&self) -> eyre::Error {
|
||||||
use IssueSubcommand::*;
|
use IssueSubcommand::*;
|
||||||
match &self.command {
|
match &self.command {
|
||||||
Create { repo, .. } | Search { repo, .. } => {
|
Create { .. } | Search { .. } => {
|
||||||
eyre::eyre!("can't figure what repo to access, try specifying with `--repo`")
|
eyre::eyre!("can't figure what repo to access, try specifying with `--repo`")
|
||||||
}
|
}
|
||||||
View { id: issue, .. }
|
View { id: issue, .. }
|
||||||
|
|
68
src/main.rs
68
src/main.rs
|
@ -174,17 +174,18 @@ struct SpecialRender {
|
||||||
body_prefix: char,
|
body_prefix: char,
|
||||||
horiz_rule: char,
|
horiz_rule: char,
|
||||||
|
|
||||||
red: &'static str,
|
// Uncomment these as needed
|
||||||
|
// red: &'static str,
|
||||||
bright_red: &'static str,
|
bright_red: &'static str,
|
||||||
green: &'static str,
|
// green: &'static str,
|
||||||
bright_green: &'static str,
|
bright_green: &'static str,
|
||||||
blue: &'static str,
|
// blue: &'static str,
|
||||||
bright_blue: &'static str,
|
bright_blue: &'static str,
|
||||||
cyan: &'static str,
|
// cyan: &'static str,
|
||||||
bright_cyan: &'static str,
|
// bright_cyan: &'static str,
|
||||||
yellow: &'static str,
|
yellow: &'static str,
|
||||||
bright_yellow: &'static str,
|
// bright_yellow: &'static str,
|
||||||
magenta: &'static str,
|
// magenta: &'static str,
|
||||||
bright_magenta: &'static str,
|
bright_magenta: &'static str,
|
||||||
black: &'static str,
|
black: &'static str,
|
||||||
dark_grey: &'static str,
|
dark_grey: &'static str,
|
||||||
|
@ -194,8 +195,7 @@ struct SpecialRender {
|
||||||
reset: &'static str,
|
reset: &'static str,
|
||||||
|
|
||||||
dark_grey_bg: &'static str,
|
dark_grey_bg: &'static str,
|
||||||
no_bg: &'static str,
|
// no_bg: &'static str,
|
||||||
|
|
||||||
hide_cursor: &'static str,
|
hide_cursor: &'static str,
|
||||||
show_cursor: &'static str,
|
show_cursor: &'static str,
|
||||||
clear_line: &'static str,
|
clear_line: &'static str,
|
||||||
|
@ -226,17 +226,17 @@ impl SpecialRender {
|
||||||
body_prefix: '▌',
|
body_prefix: '▌',
|
||||||
horiz_rule: '─',
|
horiz_rule: '─',
|
||||||
|
|
||||||
red: "\x1b[31m",
|
// red: "\x1b[31m",
|
||||||
bright_red: "\x1b[91m",
|
bright_red: "\x1b[91m",
|
||||||
green: "\x1b[32m",
|
// green: "\x1b[32m",
|
||||||
bright_green: "\x1b[92m",
|
bright_green: "\x1b[92m",
|
||||||
blue: "\x1b[34m",
|
// blue: "\x1b[34m",
|
||||||
bright_blue: "\x1b[94m",
|
bright_blue: "\x1b[94m",
|
||||||
cyan: "\x1b[36m",
|
// cyan: "\x1b[36m",
|
||||||
bright_cyan: "\x1b[96m",
|
// bright_cyan: "\x1b[96m",
|
||||||
yellow: "\x1b[33m",
|
yellow: "\x1b[33m",
|
||||||
bright_yellow: "\x1b[93m",
|
// bright_yellow: "\x1b[93m",
|
||||||
magenta: "\x1b[35m",
|
// magenta: "\x1b[35m",
|
||||||
bright_magenta: "\x1b[95m",
|
bright_magenta: "\x1b[95m",
|
||||||
black: "\x1b[30m",
|
black: "\x1b[30m",
|
||||||
dark_grey: "\x1b[90m",
|
dark_grey: "\x1b[90m",
|
||||||
|
@ -246,8 +246,7 @@ impl SpecialRender {
|
||||||
reset: "\x1b[0m",
|
reset: "\x1b[0m",
|
||||||
|
|
||||||
dark_grey_bg: "\x1b[100m",
|
dark_grey_bg: "\x1b[100m",
|
||||||
no_bg: "\x1b[49",
|
// no_bg: "\x1b[49",
|
||||||
|
|
||||||
hide_cursor: "\x1b[?25l",
|
hide_cursor: "\x1b[?25l",
|
||||||
show_cursor: "\x1b[?25h",
|
show_cursor: "\x1b[?25h",
|
||||||
clear_line: "\x1b[2K",
|
clear_line: "\x1b[2K",
|
||||||
|
@ -269,17 +268,17 @@ impl SpecialRender {
|
||||||
body_prefix: '>',
|
body_prefix: '>',
|
||||||
horiz_rule: '-',
|
horiz_rule: '-',
|
||||||
|
|
||||||
red: "",
|
// red: "",
|
||||||
bright_red: "",
|
bright_red: "",
|
||||||
green: "",
|
// green: "",
|
||||||
bright_green: "",
|
bright_green: "",
|
||||||
blue: "",
|
// blue: "",
|
||||||
bright_blue: "",
|
bright_blue: "",
|
||||||
cyan: "",
|
// cyan: "",
|
||||||
bright_cyan: "",
|
// bright_cyan: "",
|
||||||
yellow: "",
|
yellow: "",
|
||||||
bright_yellow: "",
|
// bright_yellow: "",
|
||||||
magenta: "",
|
// magenta: "",
|
||||||
bright_magenta: "",
|
bright_magenta: "",
|
||||||
black: "",
|
black: "",
|
||||||
dark_grey: "",
|
dark_grey: "",
|
||||||
|
@ -289,8 +288,7 @@ impl SpecialRender {
|
||||||
reset: "",
|
reset: "",
|
||||||
|
|
||||||
dark_grey_bg: "",
|
dark_grey_bg: "",
|
||||||
no_bg: "",
|
// no_bg: "",
|
||||||
|
|
||||||
hide_cursor: "",
|
hide_cursor: "",
|
||||||
show_cursor: "",
|
show_cursor: "",
|
||||||
clear_line: "",
|
clear_line: "",
|
||||||
|
@ -583,9 +581,10 @@ impl AnsiPrinter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn current_fg(&self) -> Option<&'static str> {
|
// Uncomment if needed
|
||||||
self.current_style().fg
|
// fn current_fg(&self) -> Option<&'static str> {
|
||||||
}
|
// self.current_style().fg
|
||||||
|
// }
|
||||||
|
|
||||||
fn start_fg(&mut self, color: &'static str) {
|
fn start_fg(&mut self, color: &'static str) {
|
||||||
self.current_style_mut().fg = Some(color);
|
self.current_style_mut().fg = Some(color);
|
||||||
|
@ -606,10 +605,11 @@ impl AnsiPrinter {
|
||||||
self.out.push_str(color);
|
self.out.push_str(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop_bg(&mut self) {
|
// Uncomment if needed
|
||||||
self.current_style_mut().bg = None;
|
// fn stop_bg(&mut self) {
|
||||||
self.out.push_str(self.special_render.no_bg);
|
// self.current_style_mut().bg = None;
|
||||||
}
|
// self.out.push_str(self.special_render.no_bg);
|
||||||
|
// }
|
||||||
|
|
||||||
fn is_bold(&self) -> bool {
|
fn is_bold(&self) -> bool {
|
||||||
self.current_style().bold
|
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
|
let (category, name) = name
|
||||||
.split_once("/")
|
.split_once("/")
|
||||||
.ok_or_eyre("label is exclusive but does not have slash")?;
|
.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");
|
let rgb_bg_dark = format!("\x1b[48;2;{r2};{g2};{b2}m");
|
||||||
print!("{rgb_bg_dark}{text_color} {category} {rgb_bg} {name} {reset} ");
|
print!("{rgb_bg_dark}{text_color} {category} {rgb_bg} {name} {reset} ");
|
||||||
} else {
|
} else {
|
||||||
|
@ -985,7 +984,7 @@ async fn view_pr_files(repo: &RepoName, api: &Forgejo, pr: Option<u64>) -> eyre:
|
||||||
limit: Some(u32::MAX),
|
limit: Some(u32::MAX),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
let (headers, files) = api
|
let (_, files) = api
|
||||||
.repo_get_pull_request_files(repo.owner(), repo.name(), pr, query)
|
.repo_get_pull_request_files(repo.owner(), repo.name(), pr, query)
|
||||||
.await?;
|
.await?;
|
||||||
let max_additions = files
|
let max_additions = files
|
||||||
|
|
|
@ -476,7 +476,7 @@ impl RepoCommand {
|
||||||
let path = path.unwrap_or_else(|| PathBuf::from(format!("./{repo_name}")));
|
let path = path.unwrap_or_else(|| PathBuf::from(format!("./{repo_name}")));
|
||||||
|
|
||||||
let SpecialRender {
|
let SpecialRender {
|
||||||
fancy, // actually using it to indicate fanciness FIXME
|
fancy,
|
||||||
hide_cursor,
|
hide_cursor,
|
||||||
show_cursor,
|
show_cursor,
|
||||||
clear_line,
|
clear_line,
|
||||||
|
|
Loading…
Reference in a new issue