Args

Struct Args 

Source
pub struct Args {
Show 15 fields pub interface_name: Option<String>, pub status: Vec<String>, pub mm_url: Option<String>, pub mm_user: Option<String>, pub secret_type: Option<SecretType>, pub keyring_service: Option<String>, pub mm_secret: Option<String>, pub mm_secret_cmd: Option<String>, pub state_dir: Option<PathBuf>, pub begin: Option<String>, pub end: Option<String>, pub expires_at: Option<String>, pub delay: Option<u32>, pub verbose: QuietVerbose, pub offdays: OffDays,
}
Expand description

Automate mattermost status with the help of wifi network

Use current visible wifi SSID to automate your mattermost status. This program is meant to either be running in background or be call regularly with option --delay 0. It will then update your mattermost custom status according to the config file

Fields§

§interface_name: Option<String>

wifi interface name

§status: Vec<String>

Status configuration triplets (:: separated)

Each triplet shall have the format: “wifi_substring::emoji_name::status_text”. If wifi_substring is empty, the ssociated status will be used for off time.

§mm_url: Option<String>

mattermost URL

§mm_user: Option<String>

User name used for mattermost login or for password or private token lookup in OS keyring.

§secret_type: Option<SecretType>

Type of secret. Either Password (default) or Token

§keyring_service: Option<String>

Service name used for mattermost secret lookup in OS keyring.

The secret is either a password (default) or atoken according to secret_type option

§mm_secret: Option<String>

mattermost private Token

Usage of this option may leak your personal token. It is recommended to use mm_token_cmd or keyring_service.

The secret is either a password (default) or atoken according to secret_type option

§mm_secret_cmd: Option<String>

mattermost secret command

The secret is either a password (default) or atoken according to secret_type option

§state_dir: Option<PathBuf>

directory for state file

Will use content of XDG_CACHE_HOME if unset.

§begin: Option<String>

beginning of status update with the format hh:mm

Before this time the status won’t be updated

§end: Option<String>

end of status update with the format hh:mm

After this time the status won’t be updated

§expires_at: Option<String>

Expiration time with the format hh:mm

This parameter is used to set the custom status expiration time Set to “0” to avoid setting expiration time

§delay: Option<u32>

delay between wifi SSID polling in seconds

§verbose: QuietVerbose§offdays: OffDays

Days off for which the custom status shall not be changed

Implementations§

Source§

impl Args

Source

pub fn update_secret_with_keyring(self) -> Result<Self>

Update args.mm_secret with the one fetched from OS keyring

Source

pub fn update_secret_with_command(self) -> Result<Args>

Update args.mm_secret with the standard output of args.mm_secret_cmd if defined.

If the secret is a password, secret will be updated later when login to the mattermost server

Source

pub fn merge_config_and_params(&self) -> Result<Args>

Merge with precedence default Args, config file and command line parameters.

Trait Implementations§

Source§

impl Debug for Args

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Args

Source§

fn default() -> Args

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Args

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Off for Args

Source§

fn is_off_time(&self) -> bool

Is the user off now ?
Source§

impl ParseArgs for Args

Source§

type Error = Error

Error type. Read more
Source§

fn parse_args() -> Result<Self, Self::Error>

Try to create a new instance of the struct. Read more
Source§

impl Serialize for Args

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructOpt for Args

Source§

fn clap<'a, 'b>() -> App<'a, 'b>

Returns clap::App corresponding to the struct.
Source§

fn from_clap(matches: &ArgMatches<'_>) -> Self

Builds the struct from clap::ArgMatches. It’s guaranteed to succeed if matches originates from an App generated by StructOpt::clap called on the same type, otherwise it must panic.
Source§

fn from_args() -> Self
where Self: Sized,

Builds the struct from the command line arguments (std::env::args_os). Calls clap::Error::exit on failure, printing the error message and aborting the program.
Source§

fn from_args_safe() -> Result<Self, Error>
where Self: Sized,

Builds the struct from the command line arguments (std::env::args_os). Unlike StructOpt::from_args, returns clap::Error on failure instead of aborting the program, so calling .exit is up to you.
Source§

fn from_iter<I>(iter: I) -> Self
where Self: Sized, I: IntoIterator, <I as IntoIterator>::Item: Into<OsString> + Clone,

Gets the struct from any iterator such as a Vec of your making. Print the error message and quit the program in case of failure. Read more
Source§

fn from_iter_safe<I>(iter: I) -> Result<Self, Error>
where Self: Sized, I: IntoIterator, <I as IntoIterator>::Item: Into<OsString> + Clone,

Gets the struct from any iterator such as a Vec of your making. Read more

Auto Trait Implementations§

§

impl Freeze for Args

§

impl RefUnwindSafe for Args

§

impl Send for Args

§

impl Sync for Args

§

impl Unpin for Args

§

impl UnwindSafe for Args

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,