mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-19 15:08:12 -07:00
server: multiple frontends + auto download from github when needed
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
#![doc = include_str!("../README.md")]
|
||||
#![doc = "\n## Example\n\n```rust"]
|
||||
#![doc = include_str!("../examples/main.rs")]
|
||||
|
||||
@@ -1,20 +1,27 @@
|
||||
use clap::{Parser, builder::PossibleValuesParser};
|
||||
use serde::Deserialize;
|
||||
use serde_with::{OneOrMany, formats::PreferOne, serde_as};
|
||||
|
||||
use crate::{Format, Index};
|
||||
|
||||
#[serde_as]
|
||||
#[derive(Debug, Deserialize, Parser)]
|
||||
pub struct Params {
|
||||
#[clap(short, long, value_parser = PossibleValuesParser::new(Index::all_possible_values()))]
|
||||
#[serde(alias = "i")]
|
||||
/// Index of the values requested
|
||||
pub index: String,
|
||||
#[clap(short, long, value_delimiter = ' ', num_args = 1..)]
|
||||
#[serde(alias = "v")]
|
||||
#[serde_as(as = "OneOrMany<_, PreferOne>")]
|
||||
/// Names of the values requested
|
||||
pub values: Vec<String>,
|
||||
#[clap(short, long, allow_hyphen_values = true)]
|
||||
#[serde(alias = "f")]
|
||||
/// Inclusive starting index, if negative will be from the end
|
||||
pub from: Option<i64>,
|
||||
#[clap(short, long, allow_hyphen_values = true)]
|
||||
#[serde(default, alias = "t")]
|
||||
/// Inclusive ending index, if negative will be from the end
|
||||
pub to: Option<i64>,
|
||||
#[clap(long)]
|
||||
|
||||
@@ -14,7 +14,10 @@ impl Tabled for Vec<Vec<serde_json::Value>> {
|
||||
let len = first.len();
|
||||
|
||||
(0..len).for_each(|index| {
|
||||
builder.push_record(self.iter().map(|vec| vec.get(index).unwrap().to_string()));
|
||||
builder.push_record(
|
||||
self.iter()
|
||||
.map(|vec| vec.get(index).unwrap().to_string().replace("\"", "")),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user