fixed the rest of the clippy warnings; bumped version to 0.10.0
This commit is contained in:
parent
a718f6f8fb
commit
45f2bb64b0
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -673,7 +673,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reel-moby"
|
name = "reel-moby"
|
||||||
version = "0.9.0"
|
version = "0.10.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "reel-moby"
|
name = "reel-moby"
|
||||||
version = "0.9.0"
|
version = "0.10.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
@ -102,7 +102,6 @@ impl Ui {
|
|||||||
Ok(Key::Ctrl('q')) => break 'core, //quit program without saving
|
Ok(Key::Ctrl('q')) => break 'core, //quit program without saving
|
||||||
Ok(Key::Char('\t')) => {
|
Ok(Key::Char('\t')) => {
|
||||||
ui.state.next();
|
ui.state.next();
|
||||||
()
|
|
||||||
}
|
}
|
||||||
Ok(Key::Ctrl('s')) => match ui.services.save() {
|
Ok(Key::Ctrl('s')) => match ui.services.save() {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -107,10 +107,7 @@ impl NoYaml {
|
|||||||
ui.repo.confirm();
|
ui.repo.confirm();
|
||||||
ui.tags = tag_list::TagList::with_repo_name(ui.repo.get());
|
ui.tags = tag_list::TagList::with_repo_name(ui.repo.get());
|
||||||
}
|
}
|
||||||
State::SelectTag => {
|
State::SelectTag => ui.tags.handle_input(Key::Char('\n')),
|
||||||
ui.tags.get_selected();
|
|
||||||
()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
Ok(Key::Char(key)) => match ui.state {
|
Ok(Key::Char(key)) => match ui.state {
|
||||||
State::EditRepo => {
|
State::EditRepo => {
|
||||||
|
@ -25,6 +25,7 @@ impl fmt::Display for Error {
|
|||||||
enum Line {
|
enum Line {
|
||||||
Status(String),
|
Status(String),
|
||||||
Image(tags::Images),
|
Image(tags::Images),
|
||||||
|
NextPage(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Line {
|
impl fmt::Display for Line {
|
||||||
@ -32,6 +33,7 @@ impl fmt::Display for Line {
|
|||||||
match self {
|
match self {
|
||||||
Line::Status(s) => write!(f, "{}", s),
|
Line::Status(s) => write!(f, "{}", s),
|
||||||
Line::Image(i) => write!(f, "{}", i),
|
Line::Image(i) => write!(f, "{}", i),
|
||||||
|
Line::NextPage(s) => write!(f, "{}", s),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,7 +70,7 @@ impl TagList {
|
|||||||
match tags.next_page() {
|
match tags.next_page() {
|
||||||
Err(_) => (),
|
Err(_) => (),
|
||||||
Ok(new_tags) => {
|
Ok(new_tags) => {
|
||||||
lines.push(Line::Status(String::from("load more tags")));
|
lines.push(Line::NextPage(String::from("load more tags")));
|
||||||
tags = new_tags;
|
tags = new_tags;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -115,24 +117,35 @@ impl TagList {
|
|||||||
match key {
|
match key {
|
||||||
Key::Down => self.next(),
|
Key::Down => self.next(),
|
||||||
Key::Up => self.previous(),
|
Key::Up => self.previous(),
|
||||||
|
Key::Char('\n') => self.select(),
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// loads new tags when matching line is selected
|
||||||
|
fn select(&mut self) {
|
||||||
|
if let Some(i) = self.state.selected() {
|
||||||
|
if let Line::NextPage(_) = &self.lines[i] {
|
||||||
|
self.load_next_page()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_selected(&mut self) -> Result<String, Error> {
|
pub fn get_selected(&mut self) -> Result<String, Error> {
|
||||||
match self.state.selected() {
|
match self.state.selected() {
|
||||||
None => Err(Error::NoneSelected),
|
None => Err(Error::NoneSelected),
|
||||||
Some(i) if i == self.lines.len() - 1 => {
|
|
||||||
self.load_next_page();
|
|
||||||
Err(Error::NextPageSelected)
|
|
||||||
}
|
|
||||||
Some(i) => match &self.lines[i] {
|
Some(i) => match &self.lines[i] {
|
||||||
Line::Status(_) => Err(Error::SelectedStatus),
|
Line::Status(_) => Err(Error::SelectedStatus),
|
||||||
Line::Image(i) => Ok(i.tag_name.clone()),
|
Line::Image(i) => Ok(i.tag_name.clone()),
|
||||||
|
Line::NextPage(_) => {
|
||||||
|
self.load_next_page();
|
||||||
|
Err(Error::NextPageSelected)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// load new tags from the next page
|
||||||
fn load_next_page(&mut self) {
|
fn load_next_page(&mut self) {
|
||||||
match &self.tags {
|
match &self.tags {
|
||||||
Some(tags) => match tags.next_page() {
|
Some(tags) => match tags.next_page() {
|
||||||
|
Loading…
Reference in New Issue
Block a user