update schema to include variables

This commit is contained in:
Kasper Juul Hermansen 2022-08-10 23:31:07 +02:00
parent 60398bbb2e
commit 91072cc4e6
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
3 changed files with 35 additions and 14 deletions

View File

@ -28,18 +28,18 @@ Starting running shell action: {}
let mut process = Command::new(self.path) let mut process = Command::new(self.path)
.current_dir(".") .current_dir(".")
.stdout(Stdio::piped()) //.stdout(Stdio::piped())
.stderr(Stdio::piped()) //.stderr(Stdio::piped())
.spawn()?; .spawn()?;
{ //{
let stdout = process.stdout.as_mut().unwrap(); // let stdout = process.stdout.as_mut().unwrap();
let stdout_reader = BufReader::new(stdout); // let stdout_reader = BufReader::new(stdout);
let mut stdout_lines = stdout_reader.lines(); // let mut stdout_lines = stdout_reader.lines();
while let Some(Ok(line)) = stdout_lines.next() { // while let Some(Ok(line)) = stdout_lines.next() {
log::info!(process=log::as_display!(self.name); "{}", line) // log::info!("{}", line);
} // }
} //}
process.wait()?; process.wait()?;

View File

@ -23,12 +23,14 @@ pub fn extract_cuddle(config: CuddleConfig) -> anyhow::Result<Arc<Mutex<Vec<Cudd
curr_dir.push(".cuddle/"); curr_dir.push(".cuddle/");
let fetch_policy = config.get_fetch_policy()?; let fetch_policy = config.get_fetch_policy()?;
if let CuddleFetchPolicy::Always = fetch_policy { if let CuddleFetchPolicy::Always = fetch_policy {
if curr_dir.exists() {
if let Err(res) = std::fs::remove_dir_all(curr_dir) { if let Err(res) = std::fs::remove_dir_all(curr_dir) {
panic!("{}", res) panic!("{}", res)
} }
} }
}
// Load main cuddle file // Load main cuddle file.
let cuddle_yaml = find_root_cuddle()?; let cuddle_yaml = find_root_cuddle()?;
log::trace!(cuddle_yaml=log::as_debug!(cuddle_yaml); "Find root cuddle"); log::trace!(cuddle_yaml=log::as_debug!(cuddle_yaml); "Find root cuddle");

View File

@ -16,10 +16,28 @@
} }
] ]
}, },
"vars": {
"type": "object",
"title": "your collection of variables to be available to cuddle",
"patternProperties": {
"^.*$": {
"anyOf": [
{
"type": "string"
},
{
"type": "object"
}
]
}
},
"additionalProperties": false
},
"scripts": { "scripts": {
"type": "object", "type": "object",
"title": "Scripts the cuddle cli can execute", "title": "Scripts the cuddle cli can execute",
"description": "Scripts the cuddle cli can execute 'cuddle x my-awesome-script'", "description": "Scripts the cuddle cli can execute 'cuddle x my-awesome-script'",
"additionalProperties": false,
"patternProperties": { "patternProperties": {
"^.*$": { "^.*$": {
"required": [ "required": [
@ -34,7 +52,8 @@
}, },
"description": { "description": {
"type": "string" "type": "string"
} },
"additionalProperties": false
} }
} }
} }