gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 92ff4422: Table: corrected wrong short option


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 92ff4422: Table: corrected wrong short option for --catrowhdu
Date: Sun, 9 Jan 2022 18:07:56 -0500 (EST)

branch: master
commit 92ff4422ce4f63a85e425b513f0430cc9a73e80f
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Table: corrected wrong short option for --catrowhdu
    
    Until now, the short-option name for the recently added '--catrowhdu' was
    '-H', which was the same short-option name for '--head'! As a result, all
    values given to '--head' were being passed to '--catrowhdu'!
    
    With this commit, '--catrowhdu' has been given a new short-option name of
    '-X', and this solved the problem. While doing this check, I noticed that
    '--catrowhdu' didn't have any default value in the Table configuration
    file.
    
    Furthermore, I noticed that there is no sanity check to avoid calling both
    '--head' and '--tail' at the same time! So a check has been added to alert
    the user when it (mistakenly!) happens.
    
    This issue was reported by Manuel Sánchez-Benavente.
---
 bin/table/args.h        | 4 ++--
 bin/table/asttable.conf | 1 +
 bin/table/ui.c          | 5 +++++
 bin/table/ui.h          | 4 ++--
 doc/gnuastro.texi       | 2 +-
 5 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/bin/table/args.h b/bin/table/args.h
index dfcdd276..b11ab2da 100644
--- a/bin/table/args.h
+++ b/bin/table/args.h
@@ -320,7 +320,7 @@ struct argp_option program_options[] =
       UI_KEY_HEAD,
       "INT",
       0,
-      "Only output given number of top rows.",
+      "Only return given number of top rows.",
       UI_GROUP_OUTROWS,
       &p->head,
       GAL_TYPE_SIZE_T,
@@ -333,7 +333,7 @@ struct argp_option program_options[] =
       UI_KEY_TAIL,
       "INT",
       0,
-      "Only output given number of bottom rows.",
+      "Only return given number of bottom rows.",
       UI_GROUP_OUTROWS,
       &p->tail,
       GAL_TYPE_SIZE_T,
diff --git a/bin/table/asttable.conf b/bin/table/asttable.conf
index 5885bb14..e00deb0e 100644
--- a/bin/table/asttable.conf
+++ b/bin/table/asttable.conf
@@ -21,4 +21,5 @@
 
 # Inputs
  wcshdu        1
+ catrowhdu     1
  catcolumnhdu  1
diff --git a/bin/table/ui.c b/bin/table/ui.c
index 8645a381..c60f3aeb 100644
--- a/bin/table/ui.c
+++ b/bin/table/ui.c
@@ -291,6 +291,11 @@ ui_read_check_only_options(struct tableparams *p)
         error(EXIT_FAILURE, 0, "at most three values can be given to each "
               "call of '--colmetadata' ('-m') after the original columns "
               "name or number. But %zu strings have been given", tmp->size);
+
+  /* '--head' and '--tail' shouldn't be called together! */
+  if(p->head!=GAL_BLANK_SIZE_T && p->tail!=GAL_BLANK_SIZE_T)
+    error(EXIT_FAILURE, 0, "'--head' and '--tail' can't be called at "
+          "the same time");
 }
 
 
diff --git a/bin/table/ui.h b/bin/table/ui.h
index 7b5dac60..2da55b28 100644
--- a/bin/table/ui.h
+++ b/bin/table/ui.h
@@ -42,7 +42,7 @@ enum program_args_groups
 /* Available letters for short options:
 
    a d f g j k l p t v x y z
-   A B G J O Q X Y
+   A B G J O Q Y
 */
 enum option_keys_enum
 {
@@ -65,7 +65,7 @@ enum option_keys_enum
   UI_KEY_CATCOLUMNHDU    = 'u',
   UI_KEY_CATCOLUMNFILE   = 'L',
   UI_KEY_CATROWFILE      = 'R',
-  UI_KEY_CATROWHDU       = 'H',
+  UI_KEY_CATROWHDU       = 'X',
   UI_KEY_COLMETADATA     = 'm',
 
   /* Only with long version (start with a value 1000, the rest will be set
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 19fce11c..70d9face 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -11621,7 +11621,7 @@ In such scenarios, to avoid potential repetition, it is 
better to use @ref{Match
 For more on using Match for this scenario, see the description of 
@option{--outcols} in @ref{Invoking astmatch}.
 @end cartouche
 
-@item -H STR
+@item -X STR
 @itemx --catrowhdu=STR
 The HDU/extension of the FITS file(s) that should be concatenated, or 
appended, by rows with @option{--catrowfile}.
 If @option{--catrowfile} is called more than once with more than one FITS 
file, its necessary to call this option more than once also (once for every 
FITS table given to @option{--catrowfile}).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]