Skip to content

Commit

Permalink
Removes partial long options from the tools (HDFGroup#872)
Browse files Browse the repository at this point in the history
Some of the command-line tools would allow partial long options (e.g.,
--datas instead of --dataset). These were inconsistently implemented,
difficult to maintain, and occasionally blocked useful long options.
They have been removed from all the tools.

NOTE: This change should NOT be merged to 1.12 or earlier.
  • Loading branch information
derobins committed Aug 3, 2021
1 parent 04f1bff commit 5dabec4
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 235 deletions.
9 changes: 9 additions & 0 deletions release_docs/RELEASE.txt
Expand Up @@ -820,6 +820,15 @@ New Features

Tools:
------
- Removed partial long exceptions

Some of the tools accepted shortened versions of the long options
(ex: --datas instead of --dataset). These were implemented inconsistently,
are difficult to maintian, and occasionally block useful long option
names. These partial long options have been removed from all the tools.

(DER - 2021/08/03)

- h5repack added help text for user-defined filters.

Added help text line that states the valid values of the filter flag
Expand Down
78 changes: 0 additions & 78 deletions tools/src/h5dump/h5dump.c
Expand Up @@ -82,124 +82,46 @@ struct handler_t {
/* "xxx" "yyy" into "xxxyyy". */
static const char * s_opts = "a:b*c:d:ef:g:hik:l:m:n*o*pq:rs:t:uvw:xyz:A*BCD:E*F:G:HM:N:O*RS:VX:";
static struct h5_long_options l_opts[] = {{"attribute", require_arg, 'a'},
{"attribut", require_arg, 'a'},
{"attribu", require_arg, 'a'},
{"attrib", require_arg, 'a'},
{"attri", require_arg, 'a'},
{"attr", require_arg, 'a'},
{"att", require_arg, 'a'},
{"at", require_arg, 'a'},
{"binary", optional_arg, 'b'},
{"count", require_arg, 'c'},
{"coun", require_arg, 'c'},
{"cou", require_arg, 'c'},
{"co", require_arg, 'c'},
{"dataset", require_arg, 'd'},
{"datase", require_arg, 'd'},
{"datas", require_arg, 'd'},
{"escape", no_arg, 'e'},
{"filedriver", require_arg, 'f'},
{"filedrive", require_arg, 'f'},
{"filedriv", require_arg, 'f'},
{"filedri", require_arg, 'f'},
{"filedr", require_arg, 'f'},
{"filed", require_arg, 'f'},
{"file", require_arg, 'f'},
{"fil", require_arg, 'f'},
{"fi", require_arg, 'f'},
{"group", require_arg, 'g'},
{"grou", require_arg, 'g'},
{"gro", require_arg, 'g'},
{"gr", require_arg, 'g'},
{"help", no_arg, 'h'},
{"hel", no_arg, 'h'},
{"object-ids", no_arg, 'i'},
{"object-id", no_arg, 'i'},
{"object-i", no_arg, 'i'},
{"object", no_arg, 'i'},
{"objec", no_arg, 'i'},
{"obje", no_arg, 'i'},
{"obj", no_arg, 'i'},
{"ob", no_arg, 'i'},
{"block", require_arg, 'k'},
{"bloc", require_arg, 'k'},
{"blo", require_arg, 'k'},
{"bl", require_arg, 'k'},
{"soft-link", require_arg, 'l'},
{"soft-lin", require_arg, 'l'},
{"soft-li", require_arg, 'l'},
{"soft-l", require_arg, 'l'},
{"soft", require_arg, 'l'},
{"sof", require_arg, 'l'},
{"format", require_arg, 'm'},
{"contents", optional_arg, 'n'},
{"output", optional_arg, 'o'},
{"outpu", optional_arg, 'o'},
{"outp", optional_arg, 'o'},
{"out", optional_arg, 'o'},
{"ou", optional_arg, 'o'},
{"properties", no_arg, 'p'},
{"sort_by", require_arg, 'q'},
{"string", no_arg, 'r'},
{"strin", no_arg, 'r'},
{"start", require_arg, 's'},
{"star", require_arg, 's'},
{"sta", require_arg, 's'},
{"datatype", require_arg, 't'},
{"datatyp", require_arg, 't'},
{"dataty", require_arg, 't'},
{"datat", require_arg, 't'},
{"use-dtd", no_arg, 'u'},
{"use-dt", no_arg, 'u'},
{"use-d", no_arg, 'u'},
{"use-", no_arg, 'u'},
{"use", no_arg, 'u'},
{"us", no_arg, 'u'},
{"u", no_arg, 'u'},
{"vds-view-first-missing", no_arg, 'v'},
{"width", require_arg, 'w'},
{"widt", require_arg, 'w'},
{"wid", require_arg, 'w'},
{"wi", require_arg, 'w'},
{"xml", no_arg, 'x'},
{"xm", no_arg, 'x'},
{"noindex", no_arg, 'y'},
{"sort_order", require_arg, 'z'},
{"onlyattr", optional_arg, 'A'},
{"superblock", no_arg, 'B'},
{"boot-block", no_arg, 'B'},
{"boot-bloc", no_arg, 'B'},
{"boot-blo", no_arg, 'B'},
{"boot-bl", no_arg, 'B'},
{"boot-b", no_arg, 'B'},
{"boot", no_arg, 'B'},
{"boo", no_arg, 'B'},
{"bo", no_arg, 'B'},
{"no-compact-subset", no_arg, 'C'},
{"xml-dtd", require_arg, 'D'},
{"xml-dt", require_arg, 'D'},
{"xml-d", require_arg, 'D'},
{"enable-error-stack", optional_arg, 'E'},
{"form", require_arg, 'F'},
{"vds-gap-size", require_arg, 'G'},
{"header", no_arg, 'H'},
{"heade", no_arg, 'H'},
{"head", no_arg, 'H'},
{"hea", no_arg, 'H'},
{"packed-bits", require_arg, 'M'},
{"any_path", require_arg, 'N'},
{"ddl", optional_arg, 'O'},
{"region", no_arg, 'R'},
{"stride", require_arg, 'S'},
{"strid", require_arg, 'S'},
{"version", no_arg, 'V'},
{"versio", no_arg, 'V'},
{"versi", no_arg, 'V'},
{"vers", no_arg, 'V'},
{"ver", no_arg, 'V'},
{"ve", no_arg, 'V'},
{"xml-ns", require_arg, 'X'},
{"xml-n", require_arg, 'X'},
{"s3-cred", require_arg, '$'},
{"hdfs-attrs", require_arg, '#'},
{"vol-value", require_arg, '1'},
Expand Down
23 changes: 3 additions & 20 deletions tools/src/h5format_convert/h5format_convert.c
Expand Up @@ -39,26 +39,9 @@ static int verbose_g = 0;
* parameters.
*/
static const char * s_opts = "hVvd:n";
static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'},
{"hel", no_arg, 'h'},
{"he", no_arg, 'h'},
{"version", no_arg, 'V'},
{"version", no_arg, 'V'},
{"versio", no_arg, 'V'},
{"versi", no_arg, 'V'},
{"vers", no_arg, 'V'},
{"verbose", no_arg, 'v'},
{"verbos", no_arg, 'v'},
{"verbo", no_arg, 'v'},
{"verb", no_arg, 'v'},
{"dname", require_arg, 'd'},
{"dnam", require_arg, 'd'},
{"dna", require_arg, 'd'},
{"dn", require_arg, 'd'},
{"noop", no_arg, 'n'},
{"noo", no_arg, 'n'},
{"no", no_arg, 'n'},
{"enable-error-stack", no_arg, 'E'},
static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"version", no_arg, 'V'},
{"verbose", no_arg, 'v'}, {"dname", require_arg, 'd'},
{"noop", no_arg, 'n'}, {"enable-error-stack", no_arg, 'E'},
{NULL, 0, '\0'}};

/*-------------------------------------------------------------------------
Expand Down
12 changes: 4 additions & 8 deletions tools/src/h5jam/h5jam.c
Expand Up @@ -34,14 +34,10 @@ char *ub_file = NULL;
* parameters. The long-named ones can be partially spelled. When
* adding more, make sure that they don't clash with each other.
*/
static const char * s_opts = "hi:u:o:c:V"; /* add more later ? */
static struct h5_long_options l_opts[] = {
{"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {"i", require_arg, 'i'}, /* input file */
{"u", require_arg, 'u'}, /* user block file */
{"o", require_arg, 'o'}, /* output file */
{"clobber", no_arg, 'c'}, /* clobber existing UB */
{"clobbe", no_arg, 'c'}, {"clobb", no_arg, 'c'}, {"clob", no_arg, 'c'},
{"clo", no_arg, 'c'}, {"cl", no_arg, 'c'}, {NULL, 0, '\0'}};
static const char * s_opts = "hi:u:o:c:V";
static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"i", require_arg, 'i'},
{"u", require_arg, 'u'}, {"o", require_arg, 'o'},
{"clobber", no_arg, 'c'}, {NULL, 0, '\0'}};

/*-------------------------------------------------------------------------
* Function: usage
Expand Down
10 changes: 3 additions & 7 deletions tools/src/h5jam/h5unjam.c
Expand Up @@ -36,13 +36,9 @@ char *ub_file = NULL;
* adding more, make sure that they don't clash with each other.
*/
static const char * s_opts = "hu:i:o:d:V";
static struct h5_long_options l_opts[] = {
{"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {"i", require_arg, 'i'}, /* input file */
{"u", require_arg, 'u'}, /* user block file */
{"o", require_arg, 'o'}, /* output file */
{"delete", no_arg, 'd'}, /* delete ub */
{"delet", no_arg, 'd'}, {"dele", no_arg, 'd'}, {"del", no_arg, 'd'},
{"de", no_arg, 'd'}, {NULL, 0, '\0'}};
static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"i", require_arg, 'i'},
{"u", require_arg, 'u'}, {"o", require_arg, 'o'},
{"delete", no_arg, 'd'}, {NULL, 0, '\0'}};

/*-------------------------------------------------------------------------
* Function: usage
Expand Down

0 comments on commit 5dabec4

Please sign in to comment.