Browse Source

Bootstrap file run-tigsite.php ; first command : makenav

master
Thierry 3 years ago
parent
commit
355aef042d
2 changed files with 75 additions and 0 deletions
  1. +15
    -0
      src/php/commands/makenav.php
  2. +60
    -0
      src/php/run-tigsite.php

+ 15
- 0
src/php/commands/makenav.php View File

@@ -0,0 +1,15 @@
<?php
/******************************************************************************
Generates navigation links for a part of a site.

@license GPL
@author Thierry Graff
@history : 2019-02-02 02:47:43+01:00, Creation
********************************************************************************/

public class makenav implements Command{
public function execute(){
}
}// end class

+ 60
- 0
src/php/run-tigsite.php View File

@@ -0,0 +1,60 @@
<?php
/********************************************************************************
CLI (command line interface) to use tigsite
usage : php run-gauquelin5.php
and follow the instructions
@license GPL
@copyright Thierry Graff
@history 2019-02-02 02:40:27+01:00, Thierry Graff : creation
********************************************************************************/

$USAGE = <<<USAGE


usage :
php {$argv[0]} <site> <action>
Examples :
php {$argv[0]} tig12 makenav maths/maths.html # Generate code to update site navigation in page maths/maths.html
<action> : voir src/php/commands/

USAGE;

// check arguments
if(count($argv) != 3){
die($USAGE);
}

// check serie
$serie = $argv[1];
if(!in_array($serie, $series)){
echo "!!! INVALID SERIE !!! : '$serie' - possible choices : '$series_str'\n";
exit;
}

// check action
$action = $argv[2];
if(!in_array($action, $series_actions[$serie])){
echo "!!! INVALID ACTION FOR SERIE $serie !!! : - possible choices : '" . implode("' or '", $series_actions[$serie]) . "'\n";
exit;
}


//
// run
//
define('DS', DIRECTORY_SEPARATOR);

require_once __DIR__ . DS . 'src' . DS . 'init' . DS . 'init.php';

use gauquelin5\Gauquelin5;
try{
echo Gauquelin5::action($action, $serie); /// here run action ///
}
catch(Exception $e){
echo 'Exception : ' . $e->getMessage() . "\n";
echo $e->getFile() . ' - line ' . $e->getLine() . "\n";
echo $e->getTraceAsString() . "\n";
}


Loading…
Cancel
Save