extern crate common;

use common::args::Args;
use common::first_run::check_first_run;
use common::project_paths::{project_paths, CONFIG_EXTENSION};

use std::path::PathBuf;

pub fn exec(args: Args) -> Result<(), String> {
    let project_paths = project_paths(&args);
    check_first_run(&project_paths.project_directory)?;

    let mut projects: Vec<String> = project_paths
        .project_directory
        .read_dir()
        .map_err(|_| "Could not read the dir")?
        .filter_map(|path| path.ok())
        .map(|path| PathBuf::from(path.file_name()))
        .filter_map(|buf| match buf.extension().and_then(|x| x.to_str()) {
            Some(CONFIG_EXTENSION) => buf
                .file_stem()
                .and_then(|x| x.to_str())
                .map(|x| x.to_string()),
            _ => None,
        })
        .collect();

    &projects.sort();

    println!("{}", &projects.join("\t\t"));

    Ok(())
}

extern crate common;

use common::args::Args;
use common::first_run::check_first_run;
use common::project_paths::{project_paths, CONFIG_EXTENSION};

use std::path::PathBuf;

pub fn exec(args: Args) -> Result<(), String> {
    let project_paths = project_paths(&args);
    check_first_run(&project_paths.project_directory)?;

    let projects: Vec<String> = project_paths
        .project_directory
        .read_dir()
        .map_err(|_| "Could not read the dir")?
        .filter_map(|path| path.ok())
        .map(|path| PathBuf::from(path.file_name()))
        .filter_map(|buf| match buf.extension().and_then(|x| x.to_str()) {
            Some(CONFIG_EXTENSION) => buf
                .file_stem()
                .and_then(|x| x.to_str())
                .map(|x| x.to_string()),
            _ => None,
        })
        .collect();

    println!("{}", projects.join(" "));

    Ok(())
}

--- 
+++ 
@@ -10,7 +10,7 @@
     let project_paths = project_paths(&args);
     check_first_run(&project_paths.project_directory)?;
 
-    let projects: Vec<String> = project_paths
+    let mut projects: Vec<String> = project_paths
         .project_directory
         .read_dir()
         .map_err(|_| "Could not read the dir")?
@@ -25,7 +25,9 @@
         })
         .collect();
 
-    println!("{}", projects.join(" "));
+    &projects.sort();
+
+    println!("{}", &projects.join("\t\t"));
 
     Ok(())
 }
Sort the list of configs and tab space
