praytime/main.vala.in

71 lines
1.9 KiB
Vala
Raw Normal View History

2017-10-19 00:24:35 +00:00
using GLib;
using Pluie;
int main (string[] argv)
{
var p = new PrayTime ("@DATA_PATH@", "@INSTALL_PATH@", "@VERSION@");
if (argv.length > 1) {
switch (argv[1]) {
case "cron" :
p.init_cron ();
break;
case "version" :
stdout.printf ("@VERSION@");
2017-10-19 00:24:35 +00:00
break;
case "play" :
if (argv.length > 2) {
p.play_adhan (argv[2]);
}
else {
stderr.printf ("missing pray parameter\n");
return 1;
}
break;
default :
string usage = """%s%s%s usage :
%s# update user crontab
# before installing please check config file
# @DATA_PATH@/praytime.ini%s
praytime %scron%s
# display program version%s
praytime %sversion%s
# play adhan (Fajr, Dhuhr, Asr, Maghrib, Isha)%s
praytime %splay %sPRAYER_NAME%s
# display prayer timings%s
praytime%s
""";
stderr.printf (
usage,
PrayTime.COLOR1,
PrayTime.HEADER,
PrayTime.COLOR6,
PrayTime.COLOR5,
PrayTime.COLOR3,
PrayTime.COLOR1,
PrayTime.COLOR5,
PrayTime.COLOR3,
PrayTime.COLOR1,
PrayTime.COLOR5,
PrayTime.COLOR3,
PrayTime.COLOR1,
PrayTime.COLOR4,
PrayTime.COLOR5,
PrayTime.COLOR3,
PrayTime.COLOR_OFF
);
break;
2017-10-19 00:24:35 +00:00
}
}
else {
p.infos ();
}
stdout.printf ("\n");
return 0;
}