complete_datastore_name: write more compact code
This commit is contained in:
		@ -79,18 +79,8 @@ pub fn save_config(config: &SectionConfigData) -> Result<(), Error> {
 | 
			
		||||
 | 
			
		||||
// shell completion helper
 | 
			
		||||
pub fn complete_datastore_name() -> Vec<String> {
 | 
			
		||||
 | 
			
		||||
    let data = match config() {
 | 
			
		||||
        Ok(data) => data,
 | 
			
		||||
    match config() {
 | 
			
		||||
        Ok(data) => data.sections.iter().map(|(id,_)| id.to_string()).collect(),
 | 
			
		||||
        Err(_) => return vec![],
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    //let test = data.sections
 | 
			
		||||
    let mut res = vec![];
 | 
			
		||||
 | 
			
		||||
    for (id, _) in data.sections {
 | 
			
		||||
        res.push(id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    res
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user