Tin

Examples · learn/18-approval · 231 of 339

approve-yes

run: --yes

examples/learn/18-approval/approve-yes.tintin run examples/learn/18-approval/approve-yes.tin
// run: --yes
/// Permanently delete a file.
guarded tool fn deleteFile(path: string): string => "deleted {path}"

fn main() {
  // approve shows a person the exact call, and runs it only on a yes
  match approve deleteFile("draft.md") {
    Ok(msg) => print(msg)
    Err(why) => print("not done: {why}")
  }
}