feat: upate runrs --list
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
const FILE_META: &'static str = "https://git.hatter.ink/rust-scripts/scriptbase/raw/branch/main/file-meta.txt";
|
||||
|
||||
pub fn list_scripts() {
|
||||
debugging!("Loading URL: {}", FILE_META);
|
||||
let response = reqwest::blocking::get(FILE_META).unwrap_or_else(|e| {
|
||||
failure_and_exit!("Get file-meta.txt failed: {}", e);
|
||||
});
|
||||
debugging!("Load response: {}", response.status().as_u16());
|
||||
if response.status().as_u16() != 200 {
|
||||
failure_and_exit!("Get file-meta.txt failed, status: {}", response.status().as_u16());
|
||||
}
|
||||
let text = response.text().unwrap_or_else(|e| {
|
||||
failure_and_exit!("Get file-meta.txt failed: {}", e);
|
||||
});
|
||||
debugging!("Response text: {}", &text);
|
||||
|
||||
let mut scripts: Vec<&str> = text.trim().split("\n").collect();
|
||||
scripts.sort();
|
||||
|
||||
Reference in New Issue
Block a user