pub struct CliTable { /* private fields */ }Expand description
Index-based template selection and parsing for CLI output.
CliTable is Send + Sync and can be safely shared across threads.
Implementations§
Source§impl CliTable
impl CliTable
Sourcepub fn new<P1, P2>(
index_path: P1,
template_dir: P2,
) -> Result<CliTable, CliTableError>
pub fn new<P1, P2>( index_path: P1, template_dir: P2, ) -> Result<CliTable, CliTableError>
Create a new CliTable from an index file.
§Arguments
index_path- Path to the index file (CSV format)template_dir- Directory containing template files
Sourcepub fn from_index(index: Arc<Index>, template_dir: PathBuf) -> CliTable
pub fn from_index(index: Arc<Index>, template_dir: PathBuf) -> CliTable
Create a CliTable from an already-parsed index.
Sourcepub fn parse_cmd(
&self,
text: &str,
attributes: &HashMap<String, String>,
) -> Result<TextTable, CliTableError>
pub fn parse_cmd( &self, text: &str, attributes: &HashMap<String, String>, ) -> Result<TextTable, CliTableError>
Parse CLI output using attribute-based template selection.
§Arguments
text- CLI output to parseattributes- Key-value pairs for template matching (e.g., “Command”, “Platform”)
Sourcepub fn parse_with_templates(
&self,
text: &str,
template_names: &[String],
) -> Result<TextTable, CliTableError>
pub fn parse_with_templates( &self, text: &str, template_names: &[String], ) -> Result<TextTable, CliTableError>
Parse CLI output with explicit template names.
Sourcepub fn find_templates(
&self,
attributes: &HashMap<String, String>,
) -> Result<Vec<PathBuf>, CliTableError>
pub fn find_templates( &self, attributes: &HashMap<String, String>, ) -> Result<Vec<PathBuf>, CliTableError>
Find the matching template paths for given attributes.
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear the template cache.
Auto Trait Implementations§
impl !Freeze for CliTable
impl RefUnwindSafe for CliTable
impl Send for CliTable
impl Sync for CliTable
impl Unpin for CliTable
impl UnwindSafe for CliTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more