Skip to content

Commit b26a2e0

Browse files
committed
start refinements
1 parent bb9bd39 commit b26a2e0

File tree

5 files changed

+22
-30
lines changed

5 files changed

+22
-30
lines changed

Cargo.lock

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ edition = "2024"
1212
anyhow = "1.0.99"
1313
blake3 = { version = "1.8.2", features = ["digest"] }
1414
clap = { version = "4.5.47", features = ["derive"] }
15-
clap-cargo = "0.17.0"
1615
comfy-table = "7.2.0"
1716
directories = "6.0.0"
1817
ed25519-dalek = { version = "=3.0.0-pre.0", features = [

ROADMAP.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
- [x] Building
99
- [x] Running
1010
- [ ] Bundling
11+
- [ ] Extraction
12+
- [ ] Building
1113
- [ ] Downloads
14+
- [ ] Downloading chunks
15+
- [ ] Downloading/Pulling Repositories
1216
- [ ] Compression
1317

1418
### Far future

src/repo/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ pub fn remove_package(package_id: &str, repo_path: &Path) -> Result<()> {
117117
/// - Repository doesn't exist
118118
/// - ID doesn't exist inside the Repository
119119
pub fn get_package(repo_path: &Path, id: &str) -> Result<PackageManifest> {
120-
println!("{repo_path:?}");
121-
122120
let repo_manifest = read_manifest(repo_path)?;
123121

124122
// Check ID's and aliases

src/run/mod.rs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub fn start<S: AsRef<OsStr>>(
2121
entrypoint: &str,
2222
args: Vec<S>,
2323
) -> Result<ExitStatus> {
24+
// This should use the `install.meta`, not the Repositories package
2425
let package_manifest =
2526
repo::get_package(repo_path, package_id).with_context(|| "Failed to get package")?;
2627
let installed_path = &repo_path.join("installed").join(package_id);
@@ -29,28 +30,29 @@ pub fn start<S: AsRef<OsStr>>(
2930
let matches: Vec<&PathBuf> = package_manifest
3031
.commands
3132
.iter()
32-
.filter(|package| package.ends_with(entrypoint))
33+
.filter(|command| command.ends_with(entrypoint))
3334
.collect();
3435

3536
// Make sure theres at least a single match
36-
if matches.is_empty() {
37-
bail!("Entrypoint does not exist.")
38-
}
39-
40-
// Install if not installed
41-
if !installed_path.exists() {
42-
install(repo_path, package_id)?;
43-
}
37+
if let Some(entrypoint) = matches.first() {
38+
// Install if not installed
39+
if !installed_path.exists() {
40+
install(repo_path, package_id).with_context(|| "Failed to install package.")?;
41+
}
4442

45-
// Allow build_manifests to have a / at the start of entrypoints, eg: /bin/bash
46-
let entrypoint = entrypoint.trim_start_matches('/');
43+
// Allow build_manifests to have a / at the start of entrypoints, eg: /bin/bash
44+
let entrypoint = entrypoint.to_string_lossy();
45+
let entrypoint: &str = entrypoint.trim_start_matches('/');
4746

48-
// Actually run the command
49-
let status = Command::new(installed_path.join(entrypoint))
50-
.args(args)
51-
.status()?;
47+
// Actually run the command
48+
let status = Command::new(installed_path.join(entrypoint))
49+
.args(args)
50+
.status()?;
5251

53-
Ok(status)
52+
Ok(status)
53+
} else {
54+
bail!("Entrypoint does not exist.")
55+
}
5456
}
5557

5658
/// Installs or Updates a Package.

0 commit comments

Comments
 (0)