diff --git a/src/cli/cmd/project/clone.rs b/src/cli/cmd/project/clone.rs index 012bc38..00d11f3 100644 --- a/src/cli/cmd/project/clone.rs +++ b/src/cli/cmd/project/clone.rs @@ -83,14 +83,15 @@ impl Input { }; if let Some(details) = opt_details { let target = self.target_dir()?.join(&details.slug); - let renku_project_cfg = RenkuProjectConfig { - renku_url: ctx.renku_url.clone(), - project: ProjectInfo { + let renku_project_cfg = RenkuProjectConfig::new( + &ctx.renku_url, + ProjectInfo { id: details.id.clone(), namespace: details.namespace.clone(), slug: details.slug.clone(), }, - }; + ); + ctx.write_err(&SimpleMessage { message: format!( "Cloning {} ({}) into {}...", diff --git a/src/config.rs b/src/config.rs index 52aa0e5..344e1c1 100644 --- a/src/config.rs +++ b/src/config.rs @@ -28,6 +28,9 @@ pub enum ConfigError { #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct RenkuProjectConfig { + /// The version of this config file. + version: u16, + /// The base url to the renku platform. pub renku_url: String, @@ -43,6 +46,14 @@ pub struct ProjectInfo { } impl RenkuProjectConfig { + pub fn new>(renku_url: S, project: ProjectInfo) -> RenkuProjectConfig { + RenkuProjectConfig { + version: 1, + renku_url: renku_url.as_ref().into(), + project, + } + } + pub fn read(file: &Path) -> Result { let cnt = std::fs::read_to_string(file).map_err(|e| ConfigError::ReadFile { source: e, @@ -82,6 +93,7 @@ impl RenkuProjectConfig { #[test] fn write_and_read_config() { let data = RenkuProjectConfig { + version: 1, renku_url: "http://renkulab.io".into(), project: ProjectInfo { id: "abc123".into(),