pub struct FormatArgs {
pub format: Format,
pub json: bool,
pub lines: bool,
pub columns: Option<String>,
pub no_header: bool,
pub header_only: bool,
}Expand description
Output format selection for vre data commands.
Flattened into each of the six vre leaf Args structs. Provides --format,
-j/--json, and -l/--lines as parallel selection paths.
Precedence (resolved by FormatArgs::resolve): -j > -l > --format.
No conflicts_with is used — clap treats default_value_t as “implicitly
set”, which would make valid calls like dsp vre project list -j collide
with the prose default. The helper-method precedence is simpler and correct.
See ADR-0003 for the output format specification and the design-decisions section of the 003 plan for why this is per-leaf rather than global.
Fields§
§format: FormatOutput format (default: prose).
json: boolShortcut for –format=json.
lines: boolShortcut for –format=lines.
columns: Option<String>Output columns for tabular formats (csv, tsv, lines): comma-separated list that selects and reorders columns. Valid names are listed in the Columns line below. Duplicates are rejected.
no_header: boolOmit the csv/tsv header row, e.g. appending rows to an existing file.
header_only: boolEmit only the csv/tsv header row, no data rows. Note: the command still contacts the server.
Implementations§
Source§impl FormatArgs
impl FormatArgs
Sourcepub fn table_options(&self, format: Format) -> Result<TableOptions, Diagnostic>
pub fn table_options(&self, format: Format) -> Result<TableOptions, Diagnostic>
Validate and resolve tabular options from the CLI flags.
format must be the resolved format (call FormatArgs::resolve
first — never pass self.format, which is always Prose when -j/-l
are used).
§Validation rules
--columnsis only valid withcsv,tsv, orlinesoutput. Any other format →Diagnostic::Usage.--no-header/--header-onlyare only valid withcsvortsv.lineshas no header concept. Any other format →Diagnostic::Usage.--columnsvalue: the string must be non-empty; each comma-separated token must be non-blank (noa,,b); no duplicates allowed. Unknown column names are validated later by the engine (which knows the per-noun set).
Returns a TableOptions whose columns field is guaranteed to be
syntactically valid (non-empty Some(Vec) with no blank entries and no
duplicates), or None if --columns was not supplied.
Trait Implementations§
Source§impl Args for FormatArgs
impl Args for FormatArgs
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 Debug for FormatArgs
impl Debug for FormatArgs
Source§impl FromArgMatches for FormatArgs
impl FromArgMatches for FormatArgs
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.