pub struct EditableFields {Show 13 fields
pub host: Option<String>,
pub port: Option<u16>,
pub socket: Option<PathBuf>,
pub user: Option<String>,
pub password_stdin: bool,
pub pin_database: Option<bool>,
pub read_only_profile: Option<bool>,
pub auth: Option<String>,
pub client_cert: Option<PathBuf>,
pub client_key: Option<PathBuf>,
pub ca: Option<PathBuf>,
pub require_tls: Option<bool>,
pub session_setup: Vec<String>,
}Expand description
Every field an edit may change.
Fields§
§host: Option<String>Server host.
port: Option<u16>Server port.
socket: Option<PathBuf>Local socket path, also spelled --pipe for the reason given on
AddArgs.
user: Option<String>User the credential belongs to.
password_stdin: boolRead a new secret from the standard input.
pin_database: Option<bool>Fix the database, so the profile stops taking a database parameter.
Three states rather than two, which every truth value an edit may write
carries here: written bare it fixes the database, written
--pin-database false it releases it, and left out it changes nothing.
Two states would make an edit that names one field reset the other, so
“not mentioned” has to be a value the field can hold.
§A stated departure
The project’s own guidance on this argument library says never to take a
truth value as Option<bool> and to use bool. Every truth value in
this struct departs from it, deliberately, and the reason is the sentence
above: that guidance is written for a flag that answers “was this
asked for”, where two states are all there is to say. These answer a
different question — “should this field change, and to what” — and it
has three answers. Collapsing it would not simplify the type, it would
silently delete stored policy on every edit that did not restate it.
The same guidance offers a way to get three states without this type: a
pair of plain bool flags, --pin-database and --no-pin-database,
each overriding the other, where writing neither is the third state.
That works, and it is declined on size rather than on correctness. The
three editable truth values here would become six flags, in a product
whose FR-053 publishes its own surface for an agent to read and whose
whole argument is that a smaller answer is a better one. Doubling the
surface to avoid one wrapper is the trade in the wrong direction.
The count said six and twelve until an audit counted them: three, not
six. The argument survived being wrong by a factor of two, because
doubling is doubling at any size — but the number is what carries it, and
this is the second time in one sitting that a sentence in this repository
stopped matching the thing beside it while still reading as true. The
first was tests/support/delegated.rs, whose own correction notes that
its count is spelled out because it was wrong once. A number in prose is
a claim, and nothing here checks it.
Recorded here rather than left to be re-derived, because a departure nobody wrote down reads as an oversight by whoever finds it next — and an alternative discarded without a line reads as one never considered.
The prose above is written for whoever maintains this, and long_help
keeps it out of the terminal. Without that, clap serves the whole doc
comment as the help of this flag, so a caller asking what a flag does was
handed an audit note naming a test file and a requirement number.
read_only_profile: Option<bool>Refuse any change through this profile.
Carries the same three states as --pin-database above, and for the
same reason. It did not, and the gap was not visible from here: the
field beside it announced that “every editable field here” had three
states while this one had two, so a reader checking the sentence rather
than the attribute found the promise and stopped. FR-087 then published
conn edit producao --read-only-profile as its example and that form
ended in 2, because the value was required.
Kept out of the terminal by long_help, for the reason stated on
--pin-database above.
auth: Option<String>Declared authentication method.
client_cert: Option<PathBuf>Client certificate presented to the server.
Editable for the reason the whole group below is: a destination that only admits an identified caller is exactly the destination whose identity expires, and an identity that can be written once but never replaced obliges the caller to delete the profile and build it again. That trades a rotation for the secret the profile holds, which the caller may no longer have.
client_key: Option<PathBuf>Key matching the client certificate.
ca: Option<PathBuf>Authority used to verify the server certificate.
require_tls: Option<bool>Whether this destination demands an encrypted channel.
Three states, matching the field it writes and --pin-database beside
it: written bare it demands encryption, written --require-tls false it
says this destination does not, and left out it changes nothing and
leaves whatever the profile already said.
session_setup: Vec<String>Session adjustments applied when opening.
A list cannot borrow the three-state shape of the values above, because
“not mentioned” and “mentioned as nothing” are the same empty list. So
the empty text is spelled out and means the empty list: --session-setup '' clears the adjustments, any other use replaces them, and leaving the
flag out keeps them. Without that spelling the adjustments would be the
one stored field an edit could add to and never take away.
Trait Implementations§
Source§impl Args for EditableFields
impl Args for EditableFields
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§impl Clone for EditableFields
impl Clone for EditableFields
Source§impl Debug for EditableFields
impl Debug for EditableFields
Source§impl FromArgMatches for EditableFields
impl FromArgMatches for EditableFields
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.