#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Command {
pub name: ::std::option::Option<::std::string::String>,
pub script_path: ::std::option::Option<::std::string::String>,
pub args: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl Command {
pub fn name(&self) -> ::std::option::Option<&str> {
self.name.as_deref()
}
pub fn script_path(&self) -> ::std::option::Option<&str> {
self.script_path.as_deref()
}
pub fn args(&self) -> &[::std::string::String] {
self.args.as_deref().unwrap_or_default()
}
}
impl Command {
pub fn builder() -> crate::types::builders::CommandBuilder {
crate::types::builders::CommandBuilder::default()
}
}
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CommandBuilder {
pub(crate) name: ::std::option::Option<::std::string::String>,
pub(crate) script_path: ::std::option::Option<::std::string::String>,
pub(crate) args: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl CommandBuilder {
pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.name = ::std::option::Option::Some(input.into());
self
}
pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.name = input;
self
}
pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
&self.name
}
pub fn script_path(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.script_path = ::std::option::Option::Some(input.into());
self
}
pub fn set_script_path(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.script_path = input;
self
}
pub fn get_script_path(&self) -> &::std::option::Option<::std::string::String> {
&self.script_path
}
pub fn args(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.args.unwrap_or_default();
v.push(input.into());
self.args = ::std::option::Option::Some(v);
self
}
pub fn set_args(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.args = input;
self
}
pub fn get_args(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.args
}
pub fn build(self) -> crate::types::Command {
crate::types::Command {
name: self.name,
script_path: self.script_path,
args: self.args,
}
}
}