Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pigeon"
version = "0.2.1"
version = "0.2.2"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl Arguments {
if self.list {
services.view(&self.endpoint);
} else {
services.run(&self.endpoint)?;
services.run(&self.endpoint, &self.args)?;
}
Ok(())
}
Expand Down
11 changes: 6 additions & 5 deletions src/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Bundle {
);
}
}
pub fn run<T: Borrow<str>>(&self, keys: &[T]) -> Result<(), anyhow::Error> {
pub fn run<T: Borrow<str>>(&self, keys: &[T], flags: &[impl Borrow<str>]) -> Result<(), anyhow::Error> {
let (Some((endpoint, environments)), _) = self.find(keys) else {
error!("couldn't find endpoint with {}", keys.join("."));
return Ok(());
Expand Down Expand Up @@ -114,7 +114,7 @@ impl Bundle {
entry.or_insert(value.clone());
});
let built_endpoint = endpoint.substitute(&config_store)?;
built_endpoint.execute(current_env.as_ref().try_into()?, &mut config_store)
built_endpoint.execute(current_env.as_ref().try_into()?, &mut config_store, flags)
}

fn build(package: &impl Borrow<str>, service_mods: HashMap<String, ServiceModule>) -> Self {
Expand Down Expand Up @@ -279,9 +279,10 @@ impl EndPoint<NotSubstituted> {
}

impl EndPoint<Substituted> {
fn execute(self, base_url: url::Url, config_store: &mut Store) -> anyhow::Result<()> {
let request_hook_flags = Option::<&str>::None.as_slice();
let response_hook_flags = Option::<&str>::None.as_slice();
fn execute(self, base_url: url::Url, config_store: &mut Store, flags:&[impl Borrow<str>]) -> anyhow::Result<()> {
let mut flags_iter = flags.split(|flag| &flag.borrow() == &"--");
let request_hook_flags = flags_iter.next().unwrap_or(&[]);
let response_hook_flags = flags_iter.next().unwrap_or(&[]);
let Self {
method,
mut headers,
Expand Down