Commit 7ca94d92 authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Update the easy commands

parent eabfdf6f
Pipeline #70106 passed with stages
in 10 minutes and 40 seconds
......@@ -87,10 +87,6 @@
/src/program/tarot-dog.h
/src/program/tarot-handful.c
/src/program/tarot-handful.h
/src/program/tarot-help.c
/src/program/tarot-help.h
/src/program/tarot-license.c
/src/program/tarot-license.h
/src/program/tarot-new.c
/src/program/tarot-new.h
/src/program/tarot-play.c
......@@ -99,8 +95,6 @@
/src/program/tarot-setup.h
/src/program/tarot-status.c
/src/program/tarot-status.h
/src/program/tarot-version.c
/src/program/tarot-version.h
/src/program/tarot.6.gz
/test-driver
/texinfo.tex
......
......@@ -181,6 +181,7 @@ http://gugurumbe.frama.io/tarot/tarot-devel.tar.gz
|
| # Build the recursive targets in parallel depth-first:
|
| (cd lib && make -j 16) || exit 1
| # src/program/tarot is called when making the manual page.
| make -j 16 src/program/tarot || exit 1
|
......
......@@ -9,10 +9,10 @@ src/program/tarot-decl-implementation.c
src/program/tarot-discard-implementation.c
src/program/tarot-dog-implementation.c
src/program/tarot-handful-implementation.c
src/program/tarot-help-implementation.c
src/program/tarot-license-implementation.c
src/program/tarot-help.c
src/program/tarot-license.c
src/program/tarot-new-implementation.c
src/program/tarot-play-implementation.c
src/program/tarot-setup-implementation.c
src/program/tarot-status-implementation.c
src/program/tarot-version-implementation.c
src/program/tarot-version.c
......@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: tarot 0.0.4-d030\n"
"Report-Msgid-Bugs-To: vivien@planete-kraus.eu\n"
"POT-Creation-Date: 2018-08-22 20:53+0200\n"
"PO-Revision-Date: 2018-08-21 22:48+0200\n"
"POT-Creation-Date: 2018-08-22 22:24+0200\n"
"PO-Revision-Date: 2018-08-22 22:25+0200\n"
"Last-Translator: Vivien Kraus <vivien@planete-kraus.eu>\n"
"Language-Team: French\n"
"Language: fr\n"
......@@ -18,12 +18,52 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: src/program/main.c:91
#: src/program/options.c:55
#, c-format
msgid ""
"%s\n"
"Play tarot.\n"
"\n"
"Usage: %s [OPTIONS]...\n"
"\n"
"Available options:\n"
" -h, --help Print this help message and exit\n"
" -V, --version Print version information and exit\n"
msgstr ""
"%s\n"
"Jouer au tarot.\n"
"\n"
"Utilisation : %s [OPTIONS]...\n"
"\n"
"Options disponibles :\n"
" -h, --help Affiche ce message d'aide et quitte\n"
" -V, --version Affiche la version du programme et quitte\n"
#: src/program/options.c:68 src/program/tarot-version.c:46
#, c-format
msgid ""
"%s\n"
"Copyright (C) 2017, 2018 Vivien Kraus <vivien@planete-kraus.eu>\n"
"This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
msgstr ""
"%s\n"
"Copyright (C) 2017, 2018 Vivien Kraus <vivien@planete-kraus.eu>\n"
"Ce logiciel est libre ; voir les sources pour les condition d'utilisation.\n"
"Il n'y a ABSOLUMENT AUCUNE GARANTIE.\n"
#: src/program/options.c:88 src/program/tarot-help.c:35
#: src/program/tarot-license.c:37 src/program/tarot-version.c:37
#, c-format
msgid "Unrecognized arguments:\n"
msgstr "Arguments non reconnus :\n"
#: src/program/main.c:88
#, c-format
msgid "Dynamic memory exhausted.\n"
msgstr "Plus de mémoire dynamique.\n"
#: src/program/main.c:105
#: src/program/main.c:102
#, c-format
msgid ""
"tarot Copyright (C) 2018 Vivien Kraus\n"
......@@ -36,55 +76,12 @@ msgstr ""
"Ceci est un logiciel libre, vous êtes invité à le redistribuer\n"
"sous certaines conditions ; tapez « license » pour plus de détails.\n"
#: src/program/main.c:182
#: src/program/main.c:179
#, c-format
msgid "Unknown command '%s', please try 'help'\n"
msgstr "Commande « %s » inconnue, veuillez essayer « help » (pour /aide/)\n"
#: src/program/main.c:210
#, c-format
msgid ""
"Manage the game of tarot.\n"
"\n"
"Available commands:\n"
" - help Print this help message.\n"
" - version Print the version of the program.\n"
" - license State the license of the program.\n"
" - new Create a new game.\n"
" - status Print the status of the game.\n"
" - setup Change the options of the current game.\n"
" - deal Deal cards for the current game.\n"
" - bid Add a bid to the current game.\n"
" - decl Add a slam declaration or not.\n"
" - call Call a card.\n"
" - dog Reveal the dog.\n"
" - discard Set the discard (may be empty).\n"
" - handful Show a handful.\n"
" - play Play a card.\n"
"\n"
"Call each command with '--help' to have additional help.\n"
msgstr ""
"Gère une partie de tarot.\n"
"\n"
"Commandes disponibles :\n"
" - help (/aide/) Affiche ce message d'aide.\n"
" - version Affiche la version du programme.\n"
" - license Affiche la license du programme.\n"
" - new (/nouvelle/) Crée une nouvelle partie.\n"
" - status (/état/) Affiche l'état de la partie.\n"
" - setup (/préparation/) Prépare la partie.\n"
" - deal (/distribution/) Renseigne les cartes de cette partie.\n"
" - bid (/enchère/) Formule une enchère dans cette partie.\n"
" - decl Formule une déclaration de chelem, ou pas.\n"
" - call (/appel/) Définit la carte appelée.\n"
" - dog (/chien/) Révèle le chien.\n"
" - discard (/écart/) Définit l'écart (peut être vide).\n"
" - handful (/poignée/) Montre une poignée.\n"
" - play (/joue/) Ajoute une carte jouée.\n"
"\n"
"Appelez chaque commande avec « --help » pour avoir plus d'aide.\n"
#: src/program/main.c:237
#: src/program/main.c:209
#, c-format
msgid "The game has been restarted.\n"
msgstr "La partie a recommencé.\n"
......@@ -96,13 +93,10 @@ msgstr "La partie a recommencé.\n"
#: src/program/tarot-discard-implementation.c:40
#: src/program/tarot-dog-implementation.c:40
#: src/program/tarot-handful-implementation.c:40
#: src/program/tarot-help-implementation.c:35
#: src/program/tarot-license-implementation.c:33
#: src/program/tarot-new-implementation.c:35
#: src/program/tarot-play-implementation.c:40
#: src/program/tarot-setup-implementation.c:38
#: src/program/tarot-status-implementation.c:42
#: src/program/tarot-version-implementation.c:33
#, c-format
msgid "Parsing failed.\n"
msgstr "Je n'ai pas compris.\n"
......@@ -209,7 +203,50 @@ msgstr ""
"Erreur : j'attendais une déclaration (pass pour passer, slam pour déclarer "
"un chelem), j'ai eu « %s »"
#: src/program/tarot-license-implementation.c:46
#: src/program/tarot-help.c:44
#, c-format
msgid ""
"Manage the game of tarot.\n"
"\n"
"Available commands:\n"
" - help Print this help message.\n"
" - version Print the version of the program.\n"
" - license State the license of the program.\n"
" - new Create a new game.\n"
" - status Print the status of the game.\n"
" - setup Change the options of the current game.\n"
" - deal Deal cards for the current game.\n"
" - bid Add a bid to the current game.\n"
" - decl Add a slam declaration or not.\n"
" - call Call a card.\n"
" - dog Reveal the dog.\n"
" - discard Set the discard (may be empty).\n"
" - handful Show a handful.\n"
" - play Play a card.\n"
"\n"
"Some commands provide additional help with '--help'.\n"
msgstr ""
"Gère une partie de tarot.\n"
"\n"
"Commandes disponibles :\n"
" - help (/aide/) Affiche ce message d'aide.\n"
" - version Affiche la version du programme.\n"
" - license Affiche la license du programme.\n"
" - new (/nouvelle/) Crée une nouvelle partie.\n"
" - status (/état/) Affiche l'état de la partie.\n"
" - setup (/préparation/) Prépare la partie.\n"
" - deal (/distribution/) Renseigne les cartes de cette partie.\n"
" - bid (/enchère/) Formule une enchère dans cette partie.\n"
" - decl Formule une déclaration de chelem, ou pas.\n"
" - call (/appel/) Définit la carte appelée.\n"
" - dog (/chien/) Révèle le chien.\n"
" - discard (/écart/) Définit l'écart (peut être vide).\n"
" - handful (/poignée/) Montre une poignée.\n"
" - play (/joue/) Ajoute une carte jouée.\n"
"\n"
"Certaines commandes donnent plus d'aide avec « --help » (/aide/).\n"
#: src/program/tarot-license.c:46
#, c-format
msgid ""
"Copyright (C) 2018 Vivien Kraus <vivien@planete-kraus.eu>\n"
......
......@@ -23,9 +23,6 @@ noinst_LTLIBRARIES += %reldir%/libcmdline.la
dist_mansix_DATA += %reldir%/tarot.6.gz
EXTRA_DIST += \
%reldir%/tarot-help.gg \
%reldir%/tarot-version.gg \
%reldir%/tarot-license.gg \
%reldir%/tarot-new.gg \
%reldir%/tarot-status.gg \
%reldir%/tarot-setup.gg \
......@@ -37,9 +34,6 @@ EXTRA_DIST += \
%reldir%/tarot-discard.gg \
%reldir%/tarot-handful.gg \
%reldir%/tarot-play.gg \
%reldir%/tarot-help-implementation.c \
%reldir%/tarot-version-implementation.c \
%reldir%/tarot-license-implementation.c \
%reldir%/tarot-new-implementation.c \
%reldir%/tarot-status-implementation.c \
%reldir%/tarot-setup-implementation.c \
......@@ -57,12 +51,12 @@ EXTRA_DIST += \
%reldir%/options.c \
%reldir%/tokenizer.h \
%reldir%/tokenizer.c \
%reldir%/tarot-help.c \
%reldir%/tarot-help.h \
%reldir%/tarot-version.c \
%reldir%/tarot-help.c \
%reldir%/tarot-version.h \
%reldir%/tarot-license.c \
%reldir%/tarot-version.c \
%reldir%/tarot-license.h \
%reldir%/tarot-license.c \
%reldir%/tarot-new.c \
%reldir%/tarot-new.h \
%reldir%/tarot-status.c \
......@@ -127,7 +121,7 @@ INDENTED += \
$(%canon_reldir%_libcmdline_la_SOURCES) \
$(%canon_reldir%_tarot_SOURCES)
%reldir%/main.c: %reldir%/tarot-help.h %reldir%/tarot-version.h %reldir%/tarot-license.h %reldir%/tarot-new.h %reldir%/tarot-status.h %reldir%/tarot-setup.h %reldir%/tarot-deal.h %reldir%/tarot-bid.h %reldir%/tarot-decl.h %reldir%/tarot-call.h %reldir%/tarot-dog.h %reldir%/tarot-discard.h %reldir%/tarot-handful.h %reldir%/tarot-play.h
%reldir%/main.c: %reldir%/tarot-new.h %reldir%/tarot-status.h %reldir%/tarot-setup.h %reldir%/tarot-deal.h %reldir%/tarot-bid.h %reldir%/tarot-decl.h %reldir%/tarot-call.h %reldir%/tarot-dog.h %reldir%/tarot-discard.h %reldir%/tarot-handful.h %reldir%/tarot-play.h
%.h %.c: %.gg
$(AM_V_GEN) ($(GENGETOPT) < $<)
......
......@@ -22,6 +22,9 @@
#include <tarot.h>
#include "options.h"
#include "tokenizer.h"
#include "tarot-help.h"
#include "tarot-version.h"
#include "tarot-license.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
......@@ -32,9 +35,6 @@
#include <locale.h>
#define _(String) gettext (String)
#include "tarot-help-implementation.c"
#include "tarot-version-implementation.c"
#include "tarot-license-implementation.c"
#include "tarot-new-implementation.c"
#include "tarot-status-implementation.c"
#include "tarot-setup-implementation.c"
......@@ -66,9 +66,6 @@ main (int argc, char *argv[])
;
}
static int handle_help (int argc, char **argv);
static int handle_version (int argc, char **argv);
static int handle_license (int argc, char **argv);
static int handle_new (int argc, char **argv);
static int handle_status (int argc, char **argv);
static int handle_setup (int argc, char **argv);
......@@ -123,15 +120,15 @@ parse (const char *str)
/* FIXME: use gperf */
else if (strcmp (argv[0], "help") == 0)
{
ret = handle_help (argc, argv);
ret = tarot_help_handle (argc, argv);
}
else if (strcmp (argv[0], "version") == 0)
{
ret = handle_version (argc, argv);
ret = tarot_version_handle (argc, argv);
}
else if (strcmp (argv[0], "license") == 0)
{
ret = handle_license (argc, argv);
ret = tarot_license_handle (argc, argv);
}
else if (strcmp (argv[0], "new") == 0)
{
......@@ -204,31 +201,6 @@ work ()
return ret;
}
static void
interactive_help ()
{
printf (_("Manage the game of tarot.\n\
\n\
Available commands:\n\
- help Print this help message.\n\
- version Print the version of the program.\n\
- license State the license of the program.\n\
- new Create a new game.\n\
- status Print the status of the game.\n\
- setup Change the options of the current game.\n\
- deal Deal cards for the current game.\n\
- bid Add a bid to the current game.\n\
- decl Add a slam declaration or not.\n\
- call Call a card.\n\
- dog Reveal the dog.\n\
- discard Set the discard (may be empty).\n\
- handful Show a handful.\n\
- play Play a card.\n\
\n\
Call each command with '--help' to have additional help.\n\
"));
}
static void
restart_game ()
{
......
/**
* file tarot-help.c Command line argument parser.
*
* Copyright (C) 2018 Vivien Kraus <vivien@planete-kraus.eu>
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include "gettext.h"
#include <locale.h>
#define _(String) gettext (String)
#include "tarot-help.h"
#include <stdlib.h>
#include <stdio.h>
int
tarot_help_handle (int argc, char *argv[])
{
if (argc > 1)
{
int i = 0;
fprintf (stderr, _("Unrecognized arguments:\n"));
for (i = 1; i < argc; i++)
{
fprintf (stderr, " - %s\n", argv[i]);
}
fprintf (stderr, "\n");
}
else
{
printf (_("Manage the game of tarot.\n\
\n\
Available commands:\n\
- help Print this help message.\n\
- version Print the version of the program.\n\
- license State the license of the program.\n\
- new Create a new game.\n\
- status Print the status of the game.\n\
- setup Change the options of the current game.\n\
- deal Deal cards for the current game.\n\
- bid Add a bid to the current game.\n\
- decl Add a slam declaration or not.\n\
- call Call a card.\n\
- dog Reveal the dog.\n\
- discard Set the discard (may be empty).\n\
- handful Show a handful.\n\
- play Play a card.\n\
\n\
Some commands provide additional help with '--help'.\n\
"));
}
return 0;
}
purpose "Play the tarot game."
description "List the available commands in the interpreter."
versiontext "Copyright (C) 2017, 2018 Vivien Kraus \
<vivien@planete-kraus.eu>\nThis is free software; see the source for \
copying conditions. There is NO warranty; not even for \
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
args "-f _tarot_command_parse_help -F src/program/tarot-help -a _tarot_command_parse_help -S --no-handle-help --no-handle-version"
text ""
text "Here, 'exit' means return to the command prompt."
\ No newline at end of file
/**
* file tarot-help-implementation.c Tarot main loop.
* file tarot-help.h Command line argument parser.
*
* Copyright (C) 2018 Vivien Kraus <vivien@planete-kraus.eu>
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either help 3 of the
* License, or (at your option) any later help.
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
......@@ -18,34 +18,18 @@
* <http://www.gnu.org/licenses/>.
*/
#include "tarot-help.h"
#include <stdlib.h>
#include <stdio.h>
#ifndef H_TAROT_HELP_INCLUDED
#define H_TAROT_HELP_INCLUDED
static void interactive_help ();
static int
handle_help (int argc, char **argv)
#ifdef __cplusplus
extern "C"
{
struct _tarot_command_parse_help args_info;
int error = 0;
error = _tarot_command_parse_help (argc, argv, &args_info);
if (error != 0)
{
fprintf (stderr, _ ("Parsing failed.\n"));
abort ();
}
if (args_info.help_given)
{
_tarot_command_parse_help_print_help ();
}
else if (args_info.version_given)
{
_tarot_command_parse_help_print_version ();
}
else
{
interactive_help ();
}
return 0;
#endif /* __cplusplus */
int tarot_help_handle (int argc, char *argv[]);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* H_TAROT_HELP_INCLUDED */
/**
* file tarot-license-implementation.c Tarot main loop.
* file tarot-license.c Command line argument parser.
*
* Copyright (C) 2018 Vivien Kraus <vivien@planete-kraus.eu>
*
......@@ -18,32 +18,32 @@
* <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include "gettext.h"
#include <locale.h>
#define _(String) gettext (String)
#include "tarot-license.h"
#include <stdlib.h>
#include <stdio.h>
static int
handle_license (int argc, char **argv)
static void interactive_help ();
int
tarot_license_handle (int argc, char *argv[])
{
struct _tarot_command_parse_license args_info;
int error = 0;
error = _tarot_command_parse_license (argc, argv, &args_info);
if (error != 0)
{
fprintf (stderr, _ ("Parsing failed.\n"));
abort ();
}
if (args_info.help_given)
{
_tarot_command_parse_license_print_help ();
}
else if (args_info.version_given)
if (argc > 1)
{
_tarot_command_parse_license_print_version ();
int i = 0;
fprintf (stderr, _("Unrecognized arguments:\n"));
for (i = 1; i < argc; i++)
{
fprintf (stderr, " - %s\n", argv[i]);
}
fprintf (stderr, "\n");
}
else
{
printf (_ ("Copyright (C) 2018 Vivien Kraus <vivien@planete-kraus.eu>\n\
printf (_("Copyright (C) 2018 Vivien Kraus <vivien@planete-kraus.eu>\n\
\n\
This program is free software: you can redistribute it and/or\n\
modify it under the terms of the GNU General Public License as\n\
......
purpose "Play the tarot game."
description "State the license of the program."
versiontext "Copyright (C) 2017, 2018 Vivien Kraus \
<vivien@planete-kraus.eu>\nThis is free software; see the source for \
copying conditions. There is NO warranty; not even for \
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
args "-f _tarot_command_parse_license -F src/program/tarot-license -a _tarot_command_parse_license -S --no-handle-help --no-handle-version"
text ""
text "Here, 'exit' means return to the command prompt."
\ No newline at end of file
/**
* file tarot-license.h Command line argument parser.
*
* Copyright (C) 2018 Vivien Kraus <vivien@planete-kraus.eu>
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef H_TAROT_LICENSE_INCLUDED
#define H_TAROT_LICENSE_INCLUDED
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
int tarot_license_handle (int argc, char *argv[]);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* H_TAROT_LICENSE_INCLUDED */
/**
* file tarot-version-implementation.c Tarot main loop.
* file tarot-version.c Command line argument parser.
*
* Copyright (C) 2018 Vivien Kraus <vivien@planete-kraus.eu>
*
......@@ -18,33 +18,36 @@
* <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include "gettext.h"
#include <locale.h>
#define _(String) gettext (String)
#include "tarot-version.h"
#include <stdlib.h>
#include <stdio.h>
static int
handle_version (int argc, char **argv)
static void interactive_version ();
int
tarot_version_handle (int argc, char *argv[])
{
struct _tarot_command_parse_version args_info;
int error = 0;
error = _tarot_command_parse_version (argc, argv, &args_info);
if (error != 0)
{
fprintf (stderr, _ ("Parsing failed.\n"));
abort ();
}
if (args_info.help_given)
{
_tarot_command_parse_version_print_help ();
}
else if (args_info.version_given)
if (argc > 1)
{
_tarot_command_parse_version_print_version ();
int i = 0;