process_command

Function process_command 

Source
pub async fn process_command(
    command: Commands,
    config_file_path: Option<String>,
    cfg_data: ConfigFile,
) -> Result<Vec<PrintableData>, Box<dyn Error>>
Expand description

Processes the command passed to the CLI

§Arguments

  • command - The command to execute
  • config_file_path - The path to the configuration file (optional, for Jira commands but mandatory to setup config)
  • cfg_data - The configuration file data

§Returns

  • A Result containing the result of the command execution

§Errors

  • If the command execution fails

§Examples

use jirust_cli::process_command;
use jirust_cli::config::config_file::ConfigFile;
use jirust_cli::args::commands::{Commands, VersionArgs, VersionActionValues, PaginationArgs, OutputArgs};

let args = VersionArgs {
  version_act: VersionActionValues::List,
  project_key: "project_key".to_string(),
  project_id: None,
  version_id: Some("97531".to_string()),
  version_name: Some("version_name".to_string()),
  version_description: Some("version_description".to_string()),
  version_start_date: None,
  version_release_date: None,
  version_archived: None,
  version_released: Some(true),
  changelog_file: None,
  pagination: PaginationArgs { page_size: Some(20), page_offset: None },
  output: OutputArgs { output_format: None, output_type: None },
  transition_assignee: None,
  transition_issues: None,
};

let result = process_command(Commands::Version(args), None, ConfigFile::default());