sys

A set of unix utils in hare!
Log | Files | Refs | README

yes.ha (336B)


      1 use fmt;
      2 use getopt;
      3 use os;
      4 
      5 use util;
      6 
      7 export fn main() void = {
      8 	const cmd = getopt::parse(os::args,
      9 		"Posative affirmation",
     10 		('m', "msg", "Affirmation to be said")
     11 		);
     12 
     13 	let msg = "y";
     14 
     15 	for (let opt .. cmd.opts) {
     16 		switch (opt.0) {
     17 		case 'm' => msg = opt.1;
     18 		case => abort();
     19 		};
     20 	};
     21 
     22 	for (true) 
     23 		fmt::println(msg)!;
     24 };