Repository: stfc/PSyclone (python)
Issue: Accept -c on command line (as short form of --config)
It is unintuitive that there is no shortcut for `--config` (which just caused some confusion).

It would also be nice if any errors in the command line would be reported when `-v` is specified ... `-v` was used as verbose, and while it then printed the version number, it did not report an error for the invalid `-c` command line. A quick look at the argparse manual seems to indicate that this is not possible, argparse exits after printing the version number. But if someone knows more, please let me know.
Pull request description: #2544 Accept -c as shortcut for --config on command line.
Trivial change, fixes #2544

Patch:
diff --git a/changelog b/changelog
index 89988e7fd..677950d5a 100644
--- a/changelog
+++ b/changelog
@@ -45,6 +45,8 @@
 	still a CodeBlock but the case bodies are transferred to a conditional
 	construct after the CodeBlock).
 
+	18) PR #2545 for #2544. Accept -c as shortcut for --config in the CLIs.
+
 release 2.5.0 14th of February 2024
 
 	1) PR #2199 for #2189. Fix bugs with missing maps in enter data
diff --git a/doc/user_guide/conf.py b/doc/user_guide/conf.py
index 272365627..4b7c4714c 100644
--- a/doc/user_guide/conf.py
+++ b/doc/user_guide/conf.py
@@ -329,7 +329,7 @@ epub_author = 'Rupert Ford, Joerg Henrichs, Iva Kavcic, Andrew Porter, ' \
     'Sergi Siso and Joseph Wallwork'
 epub_publisher = 'Rupert Ford, Joerg Henrichs, Iva Kavcic, Andrew Porter, ' \
     'Sergi Siso and Joseph Wallwork'
-epub_copyright = copyright
+epub_copyright = project_copyright
 
 # The language of the text. It defaults to the language option
 # or en if the language is not set.
diff --git a/doc/user_guide/psyclone_command.rst b/doc/user_guide/psyclone_command.rst
index ccd04c6a0..e36fd50b3 100644
--- a/doc/user_guide/psyclone_command.rst
+++ b/doc/user_guide/psyclone_command.rst
@@ -65,9 +65,9 @@ by the command:
   usage: psyclone [-h] [-oalg OALG] [-opsy OPSY] [-okern OKERN] [-api API]
                   [-s SCRIPT] [-d DIRECTORY] [-I INCLUDE] [-l {off,all,output}]
                   [-dm] [-nodm] [--kernel-renaming {multiple,single}]
-                  [--profile {invokes,routines,kernels}] [--config CONFIG]
-        		  [--backend {enable-validation,disable-validation}]
-        		  [--config CONFIG] [--version]
+                  [--profile {invokes,routines,kernels}]
+                  [--backend {enable-validation,disable-validation}]
+                  [--config CONFIG] [--version]
                   filename
 
   Run the PSyclone code generator on a particular file
@@ -103,13 +103,14 @@ by the command:
                           kernels
     --profile {invokes,routines,kernels}, -p {invokes,routines,kernels}
                           Add profiling hooks for either 'kernels' or
-            			  'invokes/routines'. The 'kernels' option is not
-            			  permitted for the 'nemo' API.
+                          'invokes/routines'. The 'kernels' option is not
+                          permitted for the 'nemo' API.
     --backend {dis,en}able-validation
                           Options to control the PSyIR backend used for code
                           generation. Use 'disable-validation' to disable the
                           validation checks that are performed by default.
-    --config CONFIG       Config file with PSyclone specific options.
+    --config CONFIG, -c CONFIG
+                          Config file with PSyclone specific options.
     --version, -v         Display version information (\ |release|\ )
 
 Basic Use
@@ -237,7 +238,7 @@ must be only one instance of the specified file within (or below) the
 specified directory:
 
 .. code-block:: bash
-		  
+
     > cd <PSYCLONEHOME>/src/psyclone
     > psyclone -d . use.f90 
     More than one match for kernel file 'testkern.[fF]90' found!
diff --git a/doc/user_guide/psyclone_kern.rst b/doc/user_guide/psyclone_kern.rst
index e7e993ad5..3da9969f7 100644
--- a/doc/user_guide/psyclone_kern.rst
+++ b/doc/user_guide/psyclone_kern.rst
@@ -91,7 +91,7 @@ The ``psyclone-kern`` command has the following arguments:
       -h, --help            show this help message and exit
       -gen {alg,stub)       what to generate for the supplied kernel
                             (alg=algorithm layer, stub=kernel-stub subroutine).
-			    Defaults to stub.
+                            Defaults to stub.
       -o OUT_FILE           filename for created code.
       -api API              choose a particular API from ['dynamo0.3',
                             'gocean1.0', 'nemo'], default 'dynamo0.3'.
@@ -103,7 +103,8 @@ The ``psyclone-kern`` command has the following arguments:
                             apply limit to both input and output
                             Fortran. Use 'output' to apply line-length
                             limit to output Fortran only.
-      --config CONFIG       config file with PSyclone specific options.
+      --config CONFIG, -c CONFIG
+                            config file with PSyclone specific options.
       -v, --version         display version information (\ |release|\ )
 
 The ``-o`` option allows the user to specify that the output should be
diff --git a/src/psyclone/generator.py b/src/psyclone/generator.py
index 7d6957223..5d7751fc7 100644
--- a/src/psyclone/generator.py
+++ b/src/psyclone/generator.py
@@ -485,7 +485,7 @@ def main(args):
               "are performed by default."))
     parser.set_defaults(dist_mem=Config.get().distributed_memory)
 
-    parser.add_argument("--config", help="Config file with "
+    parser.add_argument("--config", "-c", help="Config file with "
                         "PSyclone specific options.")
     parser.add_argument(
         '--version', '-v', action='version',
diff --git a/src/psyclone/kernel_tools.py b/src/psyclone/kernel_tools.py
index f943b835b..8a3e4cba0 100644
--- a/src/psyclone/kernel_tools.py
+++ b/src/psyclone/kernel_tools.py
@@ -116,7 +116,7 @@ def run(args):
         'output Fortran. Use \'output\' to apply line-length limit to output '
         'Fortran only.')
 
-    parser.add_argument("--config", help="config file with "
+    parser.add_argument("--config", "-c", help="config file with "
                         "PSyclone specific options.")
     parser.add_argument(
         '--version', '-v', action='version',


Test patch:
diff --git a/src/psyclone/tests/generator_test.py b/src/psyclone/tests/generator_test.py
index 88f2653ee..792b979ae 100644
--- a/src/psyclone/tests/generator_test.py
+++ b/src/psyclone/tests/generator_test.py
@@ -714,8 +714,9 @@ def test_main_api():
     # HAS_CONFIG_BEEN_INITIALISED flag!
     Config._HAS_CONFIG_BEEN_INITIALISED = False
     # This config file specifies the gocean1.0 api, but
-    # command line should take precedence
-    main([filename, "--config", config_name, "-api", "dynamo0.3"])
+    # command line should take precedence. It also tests that
+    # -c is accepted as shortcut for --config
+    main([filename, "-c", config_name, "-api", "dynamo0.3"])
     assert Config.get().api == "dynamo0.3"
     assert Config.has_config_been_initialised() is True