//                     usage.cc

#include "main.ih"

namespace 
{
    char const usage1[] = 
R"( [options] addresses cc
Where:
   [options] - optional arguments (short options between parentheses):
      --append path         - path to the file receiving mail summary info
      --cc address(es)      - (blank separated) address(es) also receiving
                              e-mails sent to the rater(s) 
                              (use quotes around multiple addresses)
      --configfile path     - path to the config-file (default:
                              )";

    char const usage2[] = 
R"()
      --debug               - write debug messages to the log file
      --error-dir (-e) dir  - store long error messages in 'dir' (default:
                              )";

    char const usage3[] = 
R"()
      --error-url (-u) url  - retrieve long error messages from 'url' 
                              (default: )";

    char const usage4[] = 
R"()
      --from address        - from address used by s-nail. If not specified
                              s-nail's -r option is not used.
                              Example: --from f.b.brokken@rug.nl
      --help (-h)           - provide this help
      --keepdir             - keep the temporary directory
      --log (-l) path       - path to the log file (default:
                              )";

    char const usage5[] = 
R"()
      --mail-zip (-m) addresses - comma-separated addresses to mail the
                              received zip to (do not use extra space chars)
      --gpg                 - processed e-mail must be gpg signed
      --no-cc               - do not send CC's to the raters
      --no-compilation      - don't compile source files
      --no-mail             - don't send e-mail (to the submitter, and if 
                              specified to the CC addresses and to the 
                              mail-zip addresses)
      --no-pdf              - if spool-path is specified the .pdf file is also
                              constructed. The no-pdf option prevents the 
                              construction of the .pdf file
      --rotate path         - path to the file containing the last used rater
                              the next initial submitted set will be stored
                              in the next rater's directory. If omitted the
                              set is stored in the spool directory itself
      --skeleton (-S) path  - path to the LaTeX skeleton file (default: 
                              )";

    char const usage6[] =
R"()
      --specs (-s) spec     - spec: "from-address zip-path"
                              From: address and FULL zip-PATH are specified
                              here, and the zip must be available.
                              Mail is not processed, and signatures aren't
                              verified
      --spool-path (-p) path - path of the destination dir for pdf-files
                              or zips. Below there directories `frank'
                              and `jurjen receive pdf or zip files of
                              exercises to be (re)-rated.
                              Implies no-pdf and not spool-zip if specified as 
                              "". (default:
                              )";

    char const usage7[] =
R"()
      --spool-zip           - the zip is not mailed (suppresses --mail-zip)
                              If .pdf construction is requested it is stored 
                              in the .zip. The .zip is stored in spool-path
      --std standard        - standard: the C++ standard used when compiling
                              sourse files (default: the standard used by
                              default by the compiler. 
                              Example: --std c++26
      --subject identifier  - identifier used in returned e-mail (default:
                              )";

    char const usage8[] =
R"()
      --tempdir (-t) path   - path to the working-dir (default (starts with)
                              )";


    char const usage9[] =
R"()
                              The last element of the specified dir may
                              not yet exist, in which case it is created
      --version (-v)        - show version information and terminate

   addresses - path to a filename holding accepted e-mail addresses
               (w/o < > markers)
    cc       - path to a filename holding addresses of raters, formatted
               using lines containing 
                    raterID rater-name mail-address
               for cc'd raters. E.g.,
                    FBB     Frank      f.b.brokken@rug.nl

The zip-file must contain a file metadata.txt and for each exercise
a separate directory, using the exercise's number as directory name

If the Subject: contains `public key' (w/o the quotes) it is assumed that
the mail contains a user's public key, which is then added to the keyring

The s-nail program handles attachments: it should be called via
/usr/bin/mail. It is installed by the s-nail package

Entries in order.txt should have extensions .txt for explanatory text files;
.cc, .cpp for C++ source files; .nc for non-compilable source files
(containing a short explanation), or end in h (header files). Entries in
order.txt starting with - (minus) are not compiled and won't appear in the
generated .pdf file.
)";

//Dropped: the zip is always checked:
//    --zip-check (-z)      - check the content of the submitted zip: only
//                            text files and specified (sub)directories are
//                            accepted

}   // namespace

void usage(std::string const &progname)
{
    cout << '\n' <<
    progname << " by " << Icmbuild::author << '\n' <<
    progname << " V" << Icmbuild::version << ' ' << Icmbuild::years << "\n"
    "\n"
    "Usage: " << progname << usage1 << Options::defaultConfigFile() << 
                             usage2 << Options::defaultErrorDir() << 
                             usage3 << Options::defaultErrorURL() << 
                             usage4 << Options::defaultLog() << 
                             usage5 << Options::defaultLatexSkeleton() << 
                             usage6 << Options::defaultSpoolPath() << 
                             usage7 << Options::defaultSubject() <<    
                             usage8 << Options::defaultWorkingDir() << 
                             usage9;
}









