-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::path::PathBuf; | ||
use std::str::FromStr; | ||
|
||
use anyhow::Result; | ||
use clap::Parser; | ||
|
||
use crate::config::Config; | ||
use crate::path::Path; | ||
use crate::root::Root; | ||
use crate::url::Url; | ||
|
||
#[derive(Debug, Parser)] | ||
pub struct Cmd { | ||
/// URL or pattern of the repository to open application in. | ||
repo: String, | ||
|
||
/// Name of the application entry. | ||
application: String, | ||
} | ||
|
||
impl Cmd { | ||
pub fn run(self) -> Result<()> { | ||
let root = Root::find()?; | ||
let config = Config::load_from(&root)?; | ||
|
||
let url = Url::from_str(&self.repo)?; | ||
let path = PathBuf::from(Path::resolve(&root, &url)); | ||
|
||
config.applications.open(&self.application, path)?; | ||
|
||
Ok(()) | ||
} | ||
} |