pub fn parse_generate(matches: &ArgMatches) {
  let config_path = matches.value_of("config").unwrap();
  let issues_path = matches.value_of("issues").unwrap();

  let config = read_config_file(config_path);
  let jira = JiraClient::new(config);
  let mut fields = match get_issue_fields(&jira) {
    Ok(issue_fields) => issue_fields,
    Err(err) => {
      eprintln!(
        "An error occurred when retrieving field names from JIRA. Using default fields. Error: {}",
        err
      );

      get_default_issue_fields_vec()
    }
  };
  fields = sort_fields(fields);
  let field_ids: Vec<&str> = fields.iter().map(|(id, _)| id.as_str()).collect();
  let field_names: Vec<&str> = fields.iter().map(|(_, name)| name.as_str()).collect();

  let mut csv_writer = csv::Writer::from_path(issues_path).unwrap();
  csv_writer.write_record(field_ids).unwrap();
  csv_writer.write_record(field_names).unwrap();
}
/// Processes the `generate` Subcommand.
/// Creates the issues template file.
Processes the `generate` Subcommand.
Creates the issues template file.
Processes the ` generate ` Subcommand . Creates the issues template file .
pub fn parse_generate(matches: &ArgMatches) {
  let config_path = matches.value_of("config").unwrap();
  let issues_path = matches.value_of("issues").unwrap();
  let config = read_config_file(config_path);
  let jira = JiraClient::new(config);
  let mut fields = match get_issue_fields(&jira) {
    Ok(issue_fields) => issue_fields,
    Err(err) => {
      eprintln!(
        "An error occurred when retrieving field names from JIRA. Using default fields. Error: {}",
        err
      );
      get_default_issue_fields_vec()
    }
  };
  fields = sort_fields(fields);
  let field_ids: Vec<&str> = fields.iter().map(|(id, _)| id.as_str()).collect();
  let field_names: Vec<&str> = fields.iter().map(|(_, name)| name.as_str()).collect();
  let mut csv_writer = csv::Writer::from_path(issues_path).unwrap();
  csv_writer.write_record(field_ids).unwrap();
  csv_writer.write_record(field_names).unwrap();
}
pub fn parse_generate ( matches : & ArgMatches ) { let config_path = matches . value_of ( " " ) . unwrap ( ) ; let issues_path = matches . value_of ( " " ) . unwrap ( ) ; let config = read_config_file ( config_path ) ; let jira = JiraClient :: new ( config ) ; let mut fields = match get_issue_fields ( & jira ) { Ok ( issue_fields ) => issue_fields , Err ( err ) => { eprintln ! ( " " err ) ; get_default_issue_fields_vec ( ) } } ; fields = sort_fields ( fields ) ; let field_ids : Vec < & str > = fields . iter ( ) . map ( | ( id , _ ) | id . as_str ( ) ) . collect ( ) ; let field_names : Vec < & str > = fields . iter ( ) . map ( | ( _ , name ) | name . as_str ( ) ) . collect ( ) ; let mut csv_writer = csv :: Writer :: from_path ( issues_path ) . unwrap ( ) ; csv_writer . write_record ( field_ids ) . unwrap ( ) ; csv_writer . write_record ( field_names ) . unwrap ( ) ; }
Processes the `generate` Subcommand.
Processes the ` generate ` Subcommand .
matches
&ArgMatches
matches
&ArgMatches