Skip to content

Commit

Permalink
feedback - Add default option in config for mainfestpath.
Browse files Browse the repository at this point in the history
  • Loading branch information
EJMFarrow committed Mar 6, 2024
1 parent 582e2f6 commit 723e139
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
8 changes: 4 additions & 4 deletions classes/cli_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ public function validate_and_clean_args(): void {
}
if (isset($cliargs['manifestpath'])) {
if (isset($cliargs['directory']) && strlen($cliargs['directory']) > 0 ) {
echo "\nYou have supplied a manifest file path and a directory. " .
"Please use only one.\n";
echo "\nYou have supplied a manifest file path (possibly as a default in your config file) " .
"and a directory. Please use only one.\n";
static::call_exit();
}
}
Expand Down Expand Up @@ -189,8 +189,8 @@ public function validate_and_clean_args(): void {
if (isset($cliargs['coursename']) || isset($cliargs['modulename'])
|| isset($cliargs['coursecategory']) || (isset($cliargs['instanceid'])
|| isset($cliargs['contextlevel']) )) {
echo "\nYou have specified a manifest file. Contextlevel, instance id, " .
"course name, module name and/or course category are not needed. " .
echo "\nYou have specified a manifest file (possibly as a default in your config file). " .
"Contextlevel, instance id, course name, module name and/or course category are not needed. " .
"Context data can be extracted from the file.\n";
static::call_exit();
}
Expand Down
7 changes: 7 additions & 0 deletions cli/config_sample.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,12 @@ $instance = 'instance1';
// Windows users must change backslash \ to forward slash /.
$rootdirectory = '/home/user/questions';

// You can set a default manifest file path for import, export and delete.
// You will need to run createrepo or importrepotomoodle first to create the file.
// You will need to set the default back to null if you want to import or delete
// from a new context. Setting the contextlevel CLI parameter will not
// override this path and will cause the script to abort.
$manifestpath = null;

// Are you using Git and wanting repository checks performed automatically?
$usegit = true;
2 changes: 1 addition & 1 deletion cli/deletefrommoodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
'longopt' => 'manifestpath',
'shortopt' => 'f',
'description' => 'Filepath of manifest file relative to root directory.',
'default' => null,
'default' => $manifestpath,
'variable' => 'manifestpath',
'valuerequired' => true,
],
Expand Down
2 changes: 1 addition & 1 deletion cli/exportrepofrommoodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
'longopt' => 'manifestpath',
'shortopt' => 'f',
'description' => 'Filepath of manifest file relative to root directory.',
'default' => null,
'default' => $manifestpath,
'variable' => 'manifestpath',
'valuerequired' => true,
],
Expand Down
2 changes: 1 addition & 1 deletion cli/importrepotomoodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
'longopt' => 'manifestpath',
'shortopt' => 'f',
'description' => 'Filepath of manifest file relative to root directory.',
'default' => null,
'default' => $manifestpath,
'variable' => 'manifestpath',
'valuerequired' => true,
],
Expand Down

0 comments on commit 723e139

Please sign in to comment.