A library for writing host-specific, single-binary configuration management and deployment tools
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
402 B

5 years ago
5 years ago
5 years ago
5 years ago
  1. use std::env;
  2. use std::process::exit;
  3. pub fn schematics_main(run: &dyn Fn(bool) -> Result<(), ()>) {
  4. let args: Box<[String]> = env::args().collect();
  5. let dry_run = match args.len() {
  6. 1 => false,
  7. 2 => {
  8. if args[1] == "--dry-run" {
  9. true
  10. } else {
  11. panic!()
  12. }
  13. }
  14. _ => panic!(),
  15. };
  16. exit(match run(dry_run) {
  17. Ok(_) => 0,
  18. Err(_) => 1,
  19. });
  20. }