chore: remove sample cmd
there's a default config and it outputs ugly inner tables anyway
This commit is contained in:
parent
f6577e6f63
commit
763fa7fbcb
1 changed files with 1 additions and 47 deletions
48
src/main.rs
48
src/main.rs
|
@ -1,9 +1,7 @@
|
|||
mod model;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use clap::{Parser, Subcommand};
|
||||
use model::{Endpoint, Extractor, PostWomanClient, PostWomanConfig, PostWomanError, StringOr};
|
||||
use model::{PostWomanConfig, PostWomanError};
|
||||
|
||||
static APP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
|
||||
|
||||
|
@ -22,9 +20,6 @@ struct PostWomanArgs {
|
|||
|
||||
#[derive(Subcommand, Debug)]
|
||||
pub enum PostWomanActions {
|
||||
/// print an example configragion, pipe to file and start editing
|
||||
Sample,
|
||||
|
||||
/// execute specific endpoint requests
|
||||
Run {
|
||||
/// regex query filter, run all with '.*'
|
||||
|
@ -49,45 +44,6 @@ pub enum PostWomanActions {
|
|||
async fn main() -> Result<(), PostWomanError> {
|
||||
let args = PostWomanArgs::parse();
|
||||
|
||||
if matches!(args.action, PostWomanActions::Sample) {
|
||||
let a = Endpoint {
|
||||
url: "https://api.alemi.dev/debug".into(),
|
||||
query: None,
|
||||
method: None,
|
||||
headers: None,
|
||||
body: None,
|
||||
extract: None,
|
||||
};
|
||||
|
||||
let b = Endpoint {
|
||||
url: "https://api.alemi.dev/debug".into(),
|
||||
query: None,
|
||||
method: Some("PUT".into()),
|
||||
headers: Some(vec![
|
||||
"Authorization: Bearer asdfg".into(),
|
||||
"Cache: skip".into(),
|
||||
]),
|
||||
body: Some(StringOr::T(toml::Table::from_iter([("hello".into(), toml::Value::String("world".into()))]))),
|
||||
extract: Some(StringOr::T(Extractor::Body)),
|
||||
};
|
||||
|
||||
let client = PostWomanClient {
|
||||
user_agent: Some(APP_USER_AGENT.into()),
|
||||
};
|
||||
|
||||
let cfg = PostWomanConfig {
|
||||
client,
|
||||
route: HashMap::from_iter([
|
||||
("simple".to_string(), a),
|
||||
("json".to_string(), b),
|
||||
]),
|
||||
};
|
||||
|
||||
println!("{}", toml_edit::ser::to_string_pretty(&cfg)?);
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let collection = std::fs::read_to_string(args.collection)?;
|
||||
let config: PostWomanConfig = toml::from_str(&collection)?;
|
||||
|
||||
|
@ -109,8 +65,6 @@ async fn main() -> Result<(), PostWomanError> {
|
|||
// PostWomanActions::Save { name, url, method, headers, body } => {
|
||||
// todo!();
|
||||
// },
|
||||
|
||||
PostWomanActions::Sample => unreachable!(),
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in a new issue