Skip to content

Commit

Permalink
Merge pull request #32 from afh/improve-list
Browse files Browse the repository at this point in the history
Only list profiles ending with .env
  • Loading branch information
humblepenguinn authored Feb 13, 2024
2 parents 3f6c0ff + 45725b4 commit f63abcb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,18 @@ pub fn list_profiles(raw: bool) {
for entry in std::fs::read_dir(profile_dir).unwrap() {
let entry = entry.unwrap();
let path = entry.path();
let file_name = path.file_name().unwrap().to_str().unwrap().to_owned();
let profile_name = file_name.replace(".env", "");
match path.extension() {
None => continue,
Some(ext) => {
if ext != "env" {
continue;
}
}
}
let profile_name = path.file_stem().unwrap().to_str().unwrap().to_owned();
if profile_name.starts_with(".") {
continue;
}
profiles.push(profile_name);
}

Expand Down

0 comments on commit f63abcb

Please sign in to comment.