Tholp's bespoke website generator
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Give !time a default format

Tholp a7662a08 3e3ff25e

+9 -15
+1 -1
src/macros/mod.rs
··· 24 24 symbol: "time", 25 25 expansion: macro_time, 26 26 takes_block: false, 27 - min_args: 1, 27 + min_args: 0, 28 28 max_args: 1, 29 29 }, 30 30 Macro {
+8 -14
src/macros/simple_macros.rs
··· 19 19 _scope: &[Token], 20 20 ) -> Vec<Token> { 21 21 let t = Local::now(); 22 - 23 - if args.len() != 1 { 24 - error_skid( 25 - context, 26 - origin_index, 27 - origin_line, 28 - &format!( 29 - "Time only accepts 1 argument, got given {} ({:?})", 30 - args.len(), 31 - args 32 - ), 33 - ); 34 - exit(1); 22 + let fmt = 23 + if args.len() == 0 { 24 + &"%+".to_string() // RFC-3339 35 25 } 26 + else 27 + { 28 + &args[0] 29 + }; 36 30 37 - return split_to_tokens(t.format(&args[0]).to_string(), origin_index); 31 + return split_to_tokens(t.format(fmt).to_string(), origin_index); 38 32 } 39 33 40 34 pub fn macro_filename(