|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
#![allow(clippy::new_without_default)]
|
|
|
|
|
extern crate bunt;
|
|
|
|
|
extern crate dirs;
|
|
|
|
|
extern crate tempfile;
|
|
|
|
@ -112,7 +113,7 @@ impl BrowserState {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
let _ = tmpfile.keep();
|
|
|
|
|
return true;
|
|
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn add_link(
|
|
|
|
@ -357,7 +358,7 @@ impl BrowserState {
|
|
|
|
|
link = self.history.clone();
|
|
|
|
|
while let Some(l) = link {
|
|
|
|
|
let fresh10 = history_key;
|
|
|
|
|
history_key = history_key + 1;
|
|
|
|
|
history_key += 1;
|
|
|
|
|
make_key_str(fresh10, &mut a, &mut b, &mut c);
|
|
|
|
|
bunt::println!("{[green]}{[green]}{[green]} {}:{}/{}", a, b, c, (*l).host, (*l).port, (*l).selector,);
|
|
|
|
|
link = (*l).next
|
|
|
|
@ -398,7 +399,7 @@ impl BrowserState {
|
|
|
|
|
if self.parse_uri(bookmark) {
|
|
|
|
|
self.view_directory(
|
|
|
|
|
&self.parsed_host.clone(),
|
|
|
|
|
self.parsed_port.clone(),
|
|
|
|
|
self.parsed_port,
|
|
|
|
|
&self.parsed_selector.clone(),
|
|
|
|
|
false,
|
|
|
|
|
);
|
|
|
|
@ -561,8 +562,8 @@ impl BrowserState {
|
|
|
|
|
let mut uri: String = self.config.start_uri.clone();
|
|
|
|
|
/* parse command line */
|
|
|
|
|
while i < argv.len() {
|
|
|
|
|
if argv[i].chars().next() == Some('-') {
|
|
|
|
|
match argv[i].chars().skip(1).next() {
|
|
|
|
|
if argv[i].starts_with('-') {
|
|
|
|
|
match argv[i].chars().nth(1) {
|
|
|
|
|
Some('H') => {
|
|
|
|
|
usage();
|
|
|
|
|
}
|
|
|
|
@ -588,7 +589,7 @@ impl BrowserState {
|
|
|
|
|
/* main loop */
|
|
|
|
|
self.view_directory(
|
|
|
|
|
&self.parsed_host.clone(),
|
|
|
|
|
self.parsed_port.clone(),
|
|
|
|
|
self.parsed_port,
|
|
|
|
|
&self.parsed_selector.clone(),
|
|
|
|
|
false,
|
|
|
|
|
); /* to display the prompt */
|
|
|
|
@ -628,8 +629,8 @@ impl BrowserState {
|
|
|
|
|
self.download_link(
|
|
|
|
|
make_key(
|
|
|
|
|
line.chars().next().unwrap(),
|
|
|
|
|
line.chars().skip(1).next().unwrap_or('\0'),
|
|
|
|
|
line.chars().skip(2).next().unwrap_or('\0'))
|
|
|
|
|
line.chars().nth(1).unwrap_or('\0'),
|
|
|
|
|
line.chars().nth(2).unwrap_or('\0'))
|
|
|
|
|
.unwrap_or(0),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -637,15 +638,15 @@ impl BrowserState {
|
|
|
|
|
if i == 1 || i == 3 || i == 4 {
|
|
|
|
|
self.view_history(make_key(
|
|
|
|
|
line.chars().next().unwrap(),
|
|
|
|
|
line.chars().skip(1).next().unwrap_or('\0'),
|
|
|
|
|
line.chars().skip(2).next().unwrap_or('\0'),
|
|
|
|
|
line.chars().nth(1).unwrap_or('\0'),
|
|
|
|
|
line.chars().nth(2).unwrap_or('\0'),
|
|
|
|
|
));
|
|
|
|
|
},
|
|
|
|
|
Some('G') => {
|
|
|
|
|
if self.parse_uri(&line[1..]) {
|
|
|
|
|
self.view_directory(
|
|
|
|
|
&self.parsed_host.clone(),
|
|
|
|
|
self.parsed_port.clone(),
|
|
|
|
|
self.parsed_port,
|
|
|
|
|
&self.parsed_selector.clone(),
|
|
|
|
|
true,
|
|
|
|
|
);
|
|
|
|
@ -657,16 +658,16 @@ impl BrowserState {
|
|
|
|
|
if i == 1 || i == 3 || i == 4 {
|
|
|
|
|
self.view_bookmarks(make_key(
|
|
|
|
|
line.chars().next().unwrap(),
|
|
|
|
|
line.chars().skip(1).next().unwrap_or('\0'),
|
|
|
|
|
line.chars().skip(2).next().unwrap_or('\0'),
|
|
|
|
|
line.chars().nth(1).unwrap_or('\0'),
|
|
|
|
|
line.chars().nth(2).unwrap_or('\0'),
|
|
|
|
|
));
|
|
|
|
|
},
|
|
|
|
|
x if !x.is_none() => {
|
|
|
|
|
x if x.is_some() => {
|
|
|
|
|
self.follow_link(
|
|
|
|
|
make_key(
|
|
|
|
|
line.chars().next().unwrap(),
|
|
|
|
|
line.chars().skip(1).next().unwrap_or('\0'),
|
|
|
|
|
line.chars().skip(2).next().unwrap_or('\0'))
|
|
|
|
|
line.chars().nth(1).unwrap_or('\0'),
|
|
|
|
|
line.chars().nth(2).unwrap_or('\0'))
|
|
|
|
|
.unwrap_or(0),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|