feat(sdk): without Some in _opts functions

Option has been removed as a wrapper around opts. This makes it much
more convenient to use

```rust
client.container_opts(Some(ContainerOpts{}))
// ->
client.container_opts(ContainerOpts{})
```

The same options are still available, either an empty object can be
passed, or a non _opts function can be used
This commit is contained in:
Kasper Juul Hermansen 2023-02-19 17:49:22 +01:00
parent 6779808322
commit 57ecf97d23
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
8 changed files with 160 additions and 228 deletions

View File

@ -171,9 +171,7 @@ fn render_optional_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Opt
} }
let required_args = quote! { let required_args = quote! {
if let Some(opts) = opts {
$(for arg in args join ($['\r']) => $arg) $(for arg in args join ($['\r']) => $arg)
}
}; };
Some(required_args) Some(required_args)
@ -273,7 +271,7 @@ fn format_function_args(
Some(( Some((
quote! { quote! {
$(required_args) $(required_args)
opts: Option<$(field_options_struct_name(field))> opts: $(field_options_struct_name(field))
}, },
true, true,
)) ))

View File

@ -5,10 +5,10 @@ fn main() -> eyre::Result<()> {
let host_source_dir = client.host().directory_opts( let host_source_dir = client.host().directory_opts(
"examples/build-the-application/app", "examples/build-the-application/app",
Some(HostDirectoryOpts { HostDirectoryOpts {
exclude: Some(vec!["node_modules".into(), "ci/".into()]), exclude: Some(vec!["node_modules".into(), "ci/".into()]),
include: None, include: None,
}), },
); );
let source = client let source = client

View File

@ -5,11 +5,9 @@ fn main() -> eyre::Result<()> {
let host_source_dir = client.host().directory_opts( let host_source_dir = client.host().directory_opts(
"./examples/caching/app", "./examples/caching/app",
Some(
dagger_sdk::HostDirectoryOptsBuilder::default() dagger_sdk::HostDirectoryOptsBuilder::default()
.exclude(vec!["node_modules", "ci/"]) .exclude(vec!["node_modules", "ci/"])
.build()?, .build()?,
),
); );
let node_cache = client.cache_volume("node").id()?; let node_cache = client.cache_volume("node").id()?;

View File

@ -6,10 +6,10 @@ fn main() -> eyre::Result<()> {
let host_source_dir = client.host().directory_opts( let host_source_dir = client.host().directory_opts(
"examples/publish-the-application/app", "examples/publish-the-application/app",
Some(HostDirectoryOpts { HostDirectoryOpts {
exclude: Some(vec!["node_modules", "ci/"]), exclude: Some(vec!["node_modules", "ci/"]),
include: None, include: None,
}), },
); );
let source = client let source = client

View File

@ -7,10 +7,10 @@ fn main() -> eyre::Result<()> {
let host_source_dir = client.host().directory_opts( let host_source_dir = client.host().directory_opts(
"examples/publish-the-application/app", "examples/publish-the-application/app",
Some(HostDirectoryOpts { HostDirectoryOpts {
exclude: Some(vec!["node_modules", "ci/"]), exclude: Some(vec!["node_modules", "ci/"]),
include: None, include: None,
}), },
); );
let source = client let source = client

View File

@ -5,10 +5,10 @@ fn main() -> eyre::Result<()> {
let host_source_dir = client.host().directory_opts( let host_source_dir = client.host().directory_opts(
"examples/test-the-application/app", "examples/test-the-application/app",
Some(HostDirectoryOpts { HostDirectoryOpts {
exclude: Some(vec!["node_modules", "ci/"]), exclude: Some(vec!["node_modules", "ci/"]),
include: None, include: None,
}), },
); );
let source = client let source = client

View File

@ -22,8 +22,8 @@ pub struct SecretId(String);
pub struct SocketId(String); pub struct SocketId(String);
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct BuildArg { pub struct BuildArg {
pub value: String,
pub name: String, pub name: String,
pub value: String,
} }
pub struct CacheVolume { pub struct CacheVolume {
pub proc: Arc<Child>, pub proc: Arc<Child>,
@ -137,11 +137,10 @@ impl Container {
}; };
} }
pub fn build_opts(&self, context: DirectoryId, opts: Option<ContainerBuildOpts>) -> Container { pub fn build_opts(&self, context: DirectoryId, opts: ContainerBuildOpts) -> Container {
let mut query = self.selection.select("build"); let mut query = self.selection.select("build");
query = query.arg("context", context); query = query.arg("context", context);
if let Some(opts) = opts {
if let Some(dockerfile) = opts.dockerfile { if let Some(dockerfile) = opts.dockerfile {
query = query.arg("dockerfile", dockerfile); query = query.arg("dockerfile", dockerfile);
} }
@ -151,7 +150,6 @@ impl Container {
if let Some(target) = opts.target { if let Some(target) = opts.target {
query = query.arg("target", target); query = query.arg("target", target);
} }
}
return Container { return Container {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -206,10 +204,9 @@ impl Container {
}; };
} }
pub fn exec_opts(&self, opts: Option<ContainerExecOpts>) -> Container { pub fn exec_opts(&self, opts: ContainerExecOpts) -> Container {
let mut query = self.selection.select("exec"); let mut query = self.selection.select("exec");
if let Some(opts) = opts {
if let Some(args) = opts.args { if let Some(args) = opts.args {
query = query.arg("args", args); query = query.arg("args", args);
} }
@ -228,7 +225,6 @@ impl Container {
experimental_privileged_nesting, experimental_privileged_nesting,
); );
} }
}
return Container { return Container {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -252,16 +248,14 @@ impl Container {
pub fn export_opts( pub fn export_opts(
&self, &self,
path: impl Into<String>, path: impl Into<String>,
opts: Option<ContainerExportOpts>, opts: ContainerExportOpts,
) -> eyre::Result<bool> { ) -> eyre::Result<bool> {
let mut query = self.selection.select("export"); let mut query = self.selection.select("export");
query = query.arg("path", path.into()); query = query.arg("path", path.into());
if let Some(opts) = opts {
if let Some(platform_variants) = opts.platform_variants { if let Some(platform_variants) = opts.platform_variants {
query = query.arg("platformVariants", platform_variants); query = query.arg("platformVariants", platform_variants);
} }
}
query.execute(&graphql_client(&self.conn)) query.execute(&graphql_client(&self.conn))
} }
@ -334,19 +328,13 @@ impl Container {
}; };
} }
pub fn pipeline_opts( pub fn pipeline_opts(&self, name: impl Into<String>, opts: ContainerPipelineOpts) -> Container {
&self,
name: impl Into<String>,
opts: Option<ContainerPipelineOpts>,
) -> Container {
let mut query = self.selection.select("pipeline"); let mut query = self.selection.select("pipeline");
query = query.arg("name", name.into()); query = query.arg("name", name.into());
if let Some(opts) = opts {
if let Some(description) = opts.description { if let Some(description) = opts.description {
query = query.arg("description", description); query = query.arg("description", description);
} }
}
return Container { return Container {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -370,16 +358,14 @@ impl Container {
pub fn publish_opts( pub fn publish_opts(
&self, &self,
address: impl Into<String>, address: impl Into<String>,
opts: Option<ContainerPublishOpts>, opts: ContainerPublishOpts,
) -> eyre::Result<String> { ) -> eyre::Result<String> {
let mut query = self.selection.select("publish"); let mut query = self.selection.select("publish");
query = query.arg("address", address.into()); query = query.arg("address", address.into());
if let Some(opts) = opts {
if let Some(platform_variants) = opts.platform_variants { if let Some(platform_variants) = opts.platform_variants {
query = query.arg("platformVariants", platform_variants); query = query.arg("platformVariants", platform_variants);
} }
}
query.execute(&graphql_client(&self.conn)) query.execute(&graphql_client(&self.conn))
} }
@ -417,14 +403,12 @@ impl Container {
}; };
} }
pub fn with_default_args_opts(&self, opts: Option<ContainerWithDefaultArgsOpts>) -> Container { pub fn with_default_args_opts(&self, opts: ContainerWithDefaultArgsOpts) -> Container {
let mut query = self.selection.select("withDefaultArgs"); let mut query = self.selection.select("withDefaultArgs");
if let Some(opts) = opts {
if let Some(args) = opts.args { if let Some(args) = opts.args {
query = query.arg("args", args); query = query.arg("args", args);
} }
}
return Container { return Container {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -449,20 +433,18 @@ impl Container {
&self, &self,
path: impl Into<String>, path: impl Into<String>,
directory: DirectoryId, directory: DirectoryId,
opts: Option<ContainerWithDirectoryOpts>, opts: ContainerWithDirectoryOpts,
) -> Container { ) -> Container {
let mut query = self.selection.select("withDirectory"); let mut query = self.selection.select("withDirectory");
query = query.arg("path", path.into()); query = query.arg("path", path.into());
query = query.arg("directory", directory); query = query.arg("directory", directory);
if let Some(opts) = opts {
if let Some(exclude) = opts.exclude { if let Some(exclude) = opts.exclude {
query = query.arg("exclude", exclude); query = query.arg("exclude", exclude);
} }
if let Some(include) = opts.include { if let Some(include) = opts.include {
query = query.arg("include", include); query = query.arg("include", include);
} }
}
return Container { return Container {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -518,7 +500,7 @@ impl Container {
pub fn with_exec_opts( pub fn with_exec_opts(
&self, &self,
args: Vec<impl Into<String>>, args: Vec<impl Into<String>>,
opts: Option<ContainerWithExecOpts>, opts: ContainerWithExecOpts,
) -> Container { ) -> Container {
let mut query = self.selection.select("withExec"); let mut query = self.selection.select("withExec");
@ -526,7 +508,6 @@ impl Container {
"args", "args",
args.into_iter().map(|i| i.into()).collect::<Vec<String>>(), args.into_iter().map(|i| i.into()).collect::<Vec<String>>(),
); );
if let Some(opts) = opts {
if let Some(stdin) = opts.stdin { if let Some(stdin) = opts.stdin {
query = query.arg("stdin", stdin); query = query.arg("stdin", stdin);
} }
@ -542,7 +523,6 @@ impl Container {
experimental_privileged_nesting, experimental_privileged_nesting,
); );
} }
}
return Container { return Container {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -578,17 +558,15 @@ impl Container {
&self, &self,
path: impl Into<String>, path: impl Into<String>,
source: FileId, source: FileId,
opts: Option<ContainerWithFileOpts>, opts: ContainerWithFileOpts,
) -> Container { ) -> Container {
let mut query = self.selection.select("withFile"); let mut query = self.selection.select("withFile");
query = query.arg("path", path.into()); query = query.arg("path", path.into());
query = query.arg("source", source); query = query.arg("source", source);
if let Some(opts) = opts {
if let Some(permissions) = opts.permissions { if let Some(permissions) = opts.permissions {
query = query.arg("permissions", permissions); query = query.arg("permissions", permissions);
} }
}
return Container { return Container {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -625,20 +603,18 @@ impl Container {
&self, &self,
path: impl Into<String>, path: impl Into<String>,
cache: CacheId, cache: CacheId,
opts: Option<ContainerWithMountedCacheOpts>, opts: ContainerWithMountedCacheOpts,
) -> Container { ) -> Container {
let mut query = self.selection.select("withMountedCache"); let mut query = self.selection.select("withMountedCache");
query = query.arg("path", path.into()); query = query.arg("path", path.into());
query = query.arg("cache", cache); query = query.arg("cache", cache);
if let Some(opts) = opts {
if let Some(source) = opts.source { if let Some(source) = opts.source {
query = query.arg("source", source); query = query.arg("source", source);
} }
if let Some(sharing) = opts.sharing { if let Some(sharing) = opts.sharing {
query = query.arg("sharing", sharing); query = query.arg("sharing", sharing);
} }
}
return Container { return Container {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -712,19 +688,17 @@ impl Container {
pub fn with_new_file_opts( pub fn with_new_file_opts(
&self, &self,
path: impl Into<String>, path: impl Into<String>,
opts: Option<ContainerWithNewFileOpts>, opts: ContainerWithNewFileOpts,
) -> Container { ) -> Container {
let mut query = self.selection.select("withNewFile"); let mut query = self.selection.select("withNewFile");
query = query.arg("path", path.into()); query = query.arg("path", path.into());
if let Some(opts) = opts {
if let Some(contents) = opts.contents { if let Some(contents) = opts.contents {
query = query.arg("contents", contents); query = query.arg("contents", contents);
} }
if let Some(permissions) = opts.permissions { if let Some(permissions) = opts.permissions {
query = query.arg("permissions", permissions); query = query.arg("permissions", permissions);
} }
}
return Container { return Container {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -951,10 +925,9 @@ impl Directory {
}; };
} }
pub fn docker_build_opts(&self, opts: Option<DirectoryDockerBuildOpts>) -> Container { pub fn docker_build_opts(&self, opts: DirectoryDockerBuildOpts) -> Container {
let mut query = self.selection.select("dockerBuild"); let mut query = self.selection.select("dockerBuild");
if let Some(opts) = opts {
if let Some(dockerfile) = opts.dockerfile { if let Some(dockerfile) = opts.dockerfile {
query = query.arg("dockerfile", dockerfile); query = query.arg("dockerfile", dockerfile);
} }
@ -967,7 +940,6 @@ impl Directory {
if let Some(target) = opts.target { if let Some(target) = opts.target {
query = query.arg("target", target); query = query.arg("target", target);
} }
}
return Container { return Container {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -981,14 +953,12 @@ impl Directory {
query.execute(&graphql_client(&self.conn)) query.execute(&graphql_client(&self.conn))
} }
pub fn entries_opts(&self, opts: Option<DirectoryEntriesOpts>) -> eyre::Result<Vec<String>> { pub fn entries_opts(&self, opts: DirectoryEntriesOpts) -> eyre::Result<Vec<String>> {
let mut query = self.selection.select("entries"); let mut query = self.selection.select("entries");
if let Some(opts) = opts {
if let Some(path) = opts.path { if let Some(path) = opts.path {
query = query.arg("path", path); query = query.arg("path", path);
} }
}
query.execute(&graphql_client(&self.conn)) query.execute(&graphql_client(&self.conn))
} }
@ -1038,19 +1008,13 @@ impl Directory {
}; };
} }
pub fn pipeline_opts( pub fn pipeline_opts(&self, name: impl Into<String>, opts: DirectoryPipelineOpts) -> Directory {
&self,
name: impl Into<String>,
opts: Option<DirectoryPipelineOpts>,
) -> Directory {
let mut query = self.selection.select("pipeline"); let mut query = self.selection.select("pipeline");
query = query.arg("name", name.into()); query = query.arg("name", name.into());
if let Some(opts) = opts {
if let Some(description) = opts.description { if let Some(description) = opts.description {
query = query.arg("description", description); query = query.arg("description", description);
} }
}
return Directory { return Directory {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1075,20 +1039,18 @@ impl Directory {
&self, &self,
path: impl Into<String>, path: impl Into<String>,
directory: DirectoryId, directory: DirectoryId,
opts: Option<DirectoryWithDirectoryOpts>, opts: DirectoryWithDirectoryOpts,
) -> Directory { ) -> Directory {
let mut query = self.selection.select("withDirectory"); let mut query = self.selection.select("withDirectory");
query = query.arg("path", path.into()); query = query.arg("path", path.into());
query = query.arg("directory", directory); query = query.arg("directory", directory);
if let Some(opts) = opts {
if let Some(exclude) = opts.exclude { if let Some(exclude) = opts.exclude {
query = query.arg("exclude", exclude); query = query.arg("exclude", exclude);
} }
if let Some(include) = opts.include { if let Some(include) = opts.include {
query = query.arg("include", include); query = query.arg("include", include);
} }
}
return Directory { return Directory {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1113,17 +1075,15 @@ impl Directory {
&self, &self,
path: impl Into<String>, path: impl Into<String>,
source: FileId, source: FileId,
opts: Option<DirectoryWithFileOpts>, opts: DirectoryWithFileOpts,
) -> Directory { ) -> Directory {
let mut query = self.selection.select("withFile"); let mut query = self.selection.select("withFile");
query = query.arg("path", path.into()); query = query.arg("path", path.into());
query = query.arg("source", source); query = query.arg("source", source);
if let Some(opts) = opts {
if let Some(permissions) = opts.permissions { if let Some(permissions) = opts.permissions {
query = query.arg("permissions", permissions); query = query.arg("permissions", permissions);
} }
}
return Directory { return Directory {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1146,16 +1106,14 @@ impl Directory {
pub fn with_new_directory_opts( pub fn with_new_directory_opts(
&self, &self,
path: impl Into<String>, path: impl Into<String>,
opts: Option<DirectoryWithNewDirectoryOpts>, opts: DirectoryWithNewDirectoryOpts,
) -> Directory { ) -> Directory {
let mut query = self.selection.select("withNewDirectory"); let mut query = self.selection.select("withNewDirectory");
query = query.arg("path", path.into()); query = query.arg("path", path.into());
if let Some(opts) = opts {
if let Some(permissions) = opts.permissions { if let Some(permissions) = opts.permissions {
query = query.arg("permissions", permissions); query = query.arg("permissions", permissions);
} }
}
return Directory { return Directory {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1180,17 +1138,15 @@ impl Directory {
&self, &self,
path: impl Into<String>, path: impl Into<String>,
contents: impl Into<String>, contents: impl Into<String>,
opts: Option<DirectoryWithNewFileOpts>, opts: DirectoryWithNewFileOpts,
) -> Directory { ) -> Directory {
let mut query = self.selection.select("withNewFile"); let mut query = self.selection.select("withNewFile");
query = query.arg("path", path.into()); query = query.arg("path", path.into());
query = query.arg("contents", contents.into()); query = query.arg("contents", contents.into());
if let Some(opts) = opts {
if let Some(permissions) = opts.permissions { if let Some(permissions) = opts.permissions {
query = query.arg("permissions", permissions); query = query.arg("permissions", permissions);
} }
}
return Directory { return Directory {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1330,17 +1286,15 @@ impl GitRef {
}; };
} }
pub fn tree_opts(&self, opts: Option<GitRefTreeOpts>) -> Directory { pub fn tree_opts(&self, opts: GitRefTreeOpts) -> Directory {
let mut query = self.selection.select("tree"); let mut query = self.selection.select("tree");
if let Some(opts) = opts {
if let Some(ssh_known_hosts) = opts.ssh_known_hosts { if let Some(ssh_known_hosts) = opts.ssh_known_hosts {
query = query.arg("sshKnownHosts", ssh_known_hosts); query = query.arg("sshKnownHosts", ssh_known_hosts);
} }
if let Some(ssh_auth_socket) = opts.ssh_auth_socket { if let Some(ssh_auth_socket) = opts.ssh_auth_socket {
query = query.arg("sshAuthSocket", ssh_auth_socket); query = query.arg("sshAuthSocket", ssh_auth_socket);
} }
}
return Directory { return Directory {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1434,22 +1388,16 @@ impl Host {
}; };
} }
pub fn directory_opts( pub fn directory_opts(&self, path: impl Into<String>, opts: HostDirectoryOpts) -> Directory {
&self,
path: impl Into<String>,
opts: Option<HostDirectoryOpts>,
) -> Directory {
let mut query = self.selection.select("directory"); let mut query = self.selection.select("directory");
query = query.arg("path", path.into()); query = query.arg("path", path.into());
if let Some(opts) = opts {
if let Some(exclude) = opts.exclude { if let Some(exclude) = opts.exclude {
query = query.arg("exclude", exclude); query = query.arg("exclude", exclude);
} }
if let Some(include) = opts.include { if let Some(include) = opts.include {
query = query.arg("include", include); query = query.arg("include", include);
} }
}
return Directory { return Directory {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1489,17 +1437,15 @@ impl Host {
}; };
} }
pub fn workdir_opts(&self, opts: Option<HostWorkdirOpts>) -> Directory { pub fn workdir_opts(&self, opts: HostWorkdirOpts) -> Directory {
let mut query = self.selection.select("workdir"); let mut query = self.selection.select("workdir");
if let Some(opts) = opts {
if let Some(exclude) = opts.exclude { if let Some(exclude) = opts.exclude {
query = query.arg("exclude", exclude); query = query.arg("exclude", exclude);
} }
if let Some(include) = opts.include { if let Some(include) = opts.include {
query = query.arg("include", include); query = query.arg("include", include);
} }
}
return Directory { return Directory {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1650,17 +1596,15 @@ impl Query {
}; };
} }
pub fn container_opts(&self, opts: Option<QueryContainerOpts>) -> Container { pub fn container_opts(&self, opts: QueryContainerOpts) -> Container {
let mut query = self.selection.select("container"); let mut query = self.selection.select("container");
if let Some(opts) = opts {
if let Some(id) = opts.id { if let Some(id) = opts.id {
query = query.arg("id", id); query = query.arg("id", id);
} }
if let Some(platform) = opts.platform { if let Some(platform) = opts.platform {
query = query.arg("platform", platform); query = query.arg("platform", platform);
} }
}
return Container { return Container {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1683,14 +1627,12 @@ impl Query {
}; };
} }
pub fn directory_opts(&self, opts: Option<QueryDirectoryOpts>) -> Directory { pub fn directory_opts(&self, opts: QueryDirectoryOpts) -> Directory {
let mut query = self.selection.select("directory"); let mut query = self.selection.select("directory");
if let Some(opts) = opts {
if let Some(id) = opts.id { if let Some(id) = opts.id {
query = query.arg("id", id); query = query.arg("id", id);
} }
}
return Directory { return Directory {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1721,15 +1663,13 @@ impl Query {
}; };
} }
pub fn git_opts(&self, url: impl Into<String>, opts: Option<QueryGitOpts>) -> GitRepository { pub fn git_opts(&self, url: impl Into<String>, opts: QueryGitOpts) -> GitRepository {
let mut query = self.selection.select("git"); let mut query = self.selection.select("git");
query = query.arg("url", url.into()); query = query.arg("url", url.into());
if let Some(opts) = opts {
if let Some(keep_git_dir) = opts.keep_git_dir { if let Some(keep_git_dir) = opts.keep_git_dir {
query = query.arg("keepGitDir", keep_git_dir); query = query.arg("keepGitDir", keep_git_dir);
} }
}
return GitRepository { return GitRepository {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1769,15 +1709,13 @@ impl Query {
}; };
} }
pub fn pipeline_opts(&self, name: impl Into<String>, opts: Option<QueryPipelineOpts>) -> Query { pub fn pipeline_opts(&self, name: impl Into<String>, opts: QueryPipelineOpts) -> Query {
let mut query = self.selection.select("pipeline"); let mut query = self.selection.select("pipeline");
query = query.arg("name", name.into()); query = query.arg("name", name.into());
if let Some(opts) = opts {
if let Some(description) = opts.description { if let Some(description) = opts.description {
query = query.arg("description", description); query = query.arg("description", description);
} }
}
return Query { return Query {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1817,14 +1755,12 @@ impl Query {
}; };
} }
pub fn socket_opts(&self, opts: Option<QuerySocketOpts>) -> Socket { pub fn socket_opts(&self, opts: QuerySocketOpts) -> Socket {
let mut query = self.selection.select("socket"); let mut query = self.selection.select("socket");
if let Some(opts) = opts {
if let Some(id) = opts.id { if let Some(id) = opts.id {
query = query.arg("id", id); query = query.arg("id", id);
} }
}
return Socket { return Socket {
proc: self.proc.clone(), proc: self.proc.clone(),

View File

@ -7,12 +7,12 @@ fn test_example_container() {
let alpine = client.container().from("alpine:3.16.2"); let alpine = client.container().from("alpine:3.16.2");
let out = alpine let out = alpine
.exec_opts(Some( .exec_opts(
ContainerExecOptsBuilder::default() ContainerExecOptsBuilder::default()
.args(vec!["cat", "/etc/alpine-release"]) .args(vec!["cat", "/etc/alpine-release"])
.build() .build()
.unwrap(), .unwrap(),
)) )
.stdout() .stdout()
.unwrap(); .unwrap();