Skip to content

Commit 866b807

Browse files
committed
feat: add support to set current directory
1 parent 218c53d commit 866b807

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ In the future this will be centralized in on its own repo/server, so you can fet
7878
"source": "~/.aws",
7979
"target": "/root/.aws"
8080
}
81-
]
81+
],
82+
"current_directory": "/root/.aws"
8283
},
8384
"lambda_python": {
8485
"image": "public.ecr.aws/lambda/python"

src/files/index.rs

+2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ pub struct Root {
1313
pub struct Package {
1414
pub image: String,
1515
pub volumes: Option<Vec<Volume>>,
16+
pub current_directory: Option<String>,
1617
}
1718

1819
impl Package {
1920
pub fn new(name: &str) -> Self {
2021
Package {
2122
image: format!("docker.io/{}", name),
2223
volumes: None,
24+
current_directory: None
2325
}
2426
}
2527
}

src/packages.rs

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ impl Package {
5757
println!(" - {}:{}", volume.source, volume.target);
5858
}
5959
}
60+
if let Some(current_directory) = &self.index.current_directory {
61+
println!(" - current directory: {}", current_directory.clone());
62+
}
6063
println!(" - versions:");
6164
for version in &self.versions.versions {
6265
if version == &self.versions.current {

src/runner.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ pub fn run(package: &Package, params: &Vec<String>) -> bool {
5252
args.push("-i".to_string());
5353
}
5454

55-
// Handling volumes if available
5655
if let Some(volumes) = &package.index.volumes {
5756
for volume in volumes {
5857
let source = shellexpand::full(&volume.source).unwrap();
@@ -65,6 +64,11 @@ pub fn run(package: &Package, params: &Vec<String>) -> bool {
6564
}
6665
}
6766

67+
if let Some(current_directory) = &package.index.current_directory {
68+
args.push("-w".to_string());
69+
args.push(current_directory.clone());
70+
}
71+
6872
args.push(format!(
6973
"{}:{}",
7074
package.index.image.clone(),

0 commit comments

Comments
 (0)