2017-11-04 02:14:21 +00:00
using GLib ;
using Pluie ;
errordomain MyError {
CODE
}
int main ( string [ ] args )
{
2017-11-17 22:01:08 +00:00
Echo . init ( true , " echo.ini " ) ;
2017-11-04 02:14:21 +00:00
Dbg . in ( Log . METHOD , null , Log . LINE , Log . FILE ) ;
of . title ( " MyApp " , " 0.2.2 " , " a-sansara " ) ;
2017-11-17 22:01:08 +00:00
2017-11-04 02:14:21 +00:00
of . echo ( " sample echo \n " ) ;
2017-11-17 22:01:08 +00:00
2017-11-04 02:14:21 +00:00
of . keyval ( " path " , " /tmp/blob " ) ;
of . keyval ( " otherlongoption " , " other value " ) ;
2017-11-17 22:01:08 +00:00
2017-11-04 02:14:21 +00:00
of . echo ( " \n sample echo \n on multiple \n line " , true , true ) ;
2017-11-17 22:01:08 +00:00
2017-11-04 02:14:21 +00:00
of . action ( " reading config " , " toto.conf " ) ;
2017-11-17 22:01:08 +00:00
2017-11-04 02:14:21 +00:00
of . state ( false ) ;
2017-11-17 22:01:08 +00:00
2017-11-04 02:14:21 +00:00
of . warn ( " boloss warning " ) ;
of . echo ( ) ;
var cmd = new Sys . Cmd ( " ls -la " ) ;
2017-11-17 22:01:08 +00:00
int status = cmd . run ( ) ;
2017-11-04 02:14:21 +00:00
of . action ( " running cmd " , cmd . name ) ;
of . echo ( " \n %s " . printf ( cmd . output ) , true , true ) ;
2017-11-17 22:01:08 +00:00
2017-11-04 02:14:21 +00:00
of . state ( status = = 0 ) ;
2017-11-17 22:01:08 +00:00
2017-11-04 02:14:21 +00:00
try {
throw new MyError . CODE ( " this is the error message " ) ;
}
catch ( MyError e ) {
of . error ( e . message ) ;
}
of . rs ( true ) ;
of . rs ( true , " ok " ) ;
of . rs ( false , " " , " exit " ) ;
2017-11-17 22:01:08 +00:00
2017-11-04 02:14:21 +00:00
of . echo ( ) ;
2017-11-17 22:01:08 +00:00
2017-11-04 02:14:21 +00:00
string com = " Vala is syntactically similar to C# and includes several features such as: anonymous functions, signals, properties, generics, assisted memory management, exception handling, type inference, and foreach statements.[3] Its developers Jürg Billeter and Raffaele Sandrini aim to bring these features to the plain C runtime with little overhead and no special runtime support by targeting the GObject object system " ;
string mycom = of . wordwrap ( com , of . term_width - 44 ) ;
int line = mycom . split ( " \n " ) . length ;
of . echo ( mycom , true , true , ECHO . COMMENT , 40 ) ;
2017-11-17 22:01:08 +00:00
2017-11-04 02:14:21 +00:00
of . usage_option ( " quiet " , " q " , " SHUTUP " , false , line ) ;
of . echo ( ) ;
2017-11-17 22:01:08 +00:00
2017-11-04 02:14:21 +00:00
of . echo ( mycom , true , true , ECHO . COMMENT , 40 ) ;
of . usage_option ( " record-desktop " , " r " , " TIME " , false , line ) ;
of . echo ( ) ;
Dbg . out ( Log . METHOD , null , Log . LINE , Log . FILE ) ;
return 0 ;
}