Permalink
Browse files

auxents doc iterate

  • Loading branch information...
johnkerl committed Jan 6, 2018
1 parent 6556d95 commit 66eb0e4fb35f0128a96fe9077508513b72d0f494
Showing with 30 additions and 7 deletions.
  1. +10 −6 c/auxents/aux_entries.c
  2. +1 −0 c/auxents/aux_entries.h
  3. +15 −0 c/cli/mlrcli.c
  4. +1 −1 c/lib/mlrutil.c
  5. +3 −0 doc/mkman.rb
View
@@ -63,6 +63,14 @@ void do_aux_entries(int argc, char** argv) {
// else return to mlrmain for the rest of Miller.
}
void show_aux_entries(FILE* fp) {
fprintf(fp, "Available subcommands:\n");
for (int i = 0; i < aux_lookup_table_size; i++) {
fprintf(fp, " %s\n", aux_lookup_table[i].name);
}
fprintf(fp, "For more information, please invoke %s {subcommand} --help\n", MLR_GLOBALS.bargv0);
}
// ----------------------------------------------------------------
static void aux_list_usage(char* argv0, char* argv1, FILE* o, int exit_code) {
fprintf(o, "Usage: %s %s [options]\n", argv0, argv1);
@@ -71,12 +79,8 @@ static void aux_list_usage(char* argv0, char* argv1, FILE* o, int exit_code) {
exit(exit_code);
}
static int aux_list_main(int argc, char** argv) {
printf("Available subcommands:\n");
for (int i = 0; i < aux_lookup_table_size; i++) {
printf(" %s\n", aux_lookup_table[i].name);
}
printf("For more information, please invoke %s {subcommand} --help\n", MLR_GLOBALS.bargv0);
int aux_list_main(int argc, char** argv) {
show_aux_entries(stdout);
return 0;
}
View
@@ -5,5 +5,6 @@
// If the argument after the basename (i.e. argv[1]) is recognized then this function doesn't return,
// invoking the code for that argument instead and exiting.
void do_aux_entries(int argc, char** argv);
void show_aux_entries(FILE* fp);
#endif // AUX_ENTRIES_H
View
@@ -17,6 +17,7 @@
#include "cli/mlrcli.h"
#include "cli/quoting.h"
#include "cli/argparse.h"
#include "auxents/aux_entries.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -114,6 +115,7 @@ static void main_usage_double_quoting(FILE* o, char* argv0);
static void main_usage_numerical_formatting(FILE* o, char* argv0);
static void main_usage_other_options(FILE* o, char* argv0);
static void main_usage_then_chaining(FILE* o, char* argv0);
static void main_usage_auxents(FILE* o, char* argv0);
static void main_usage_see_also(FILE* o, char* argv0);
static void print_type_arithmetic_info(FILE* o, char* argv0);
static void usage_all_verbs(char* argv0);
@@ -586,6 +588,10 @@ static void main_usage_long(FILE* o, char* argv0) {
main_usage_then_chaining(o, argv0);
fprintf(o, "\n");
fprintf(o, "Auxiliary commands:\n");
main_usage_auxents(o, argv0);
fprintf(o, "\n");
main_usage_see_also(o, argv0);
}
@@ -973,6 +979,12 @@ static void main_usage_then_chaining(FILE* o, char* argv0) {
fprintf(o, " %s stats1 -a min,mean,max -f flag,u,v -g color then sort -f color\n", argv0);
}
static void main_usage_auxents(FILE* o, char* argv0) {
fprintf(o, "Miller has a few otherwise-standalone executables packaged within it.\n");
fprintf(o, "They do not participate in any other parts of Miller.\n");
show_aux_entries(o);
}
static void main_usage_see_also(FILE* o, char* argv0) {
fprintf(o, "For more information please see http://johnkerl.org/miller/doc and/or\n");
fprintf(o, "http://github.com/johnkerl/miller.");
@@ -1402,6 +1414,9 @@ static int handle_terminal_usage(char** argv, int argc, int argi) {
} else if (streq(argv[argi], "--usage-then-chaining")) {
main_usage_then_chaining(stdout, MLR_GLOBALS.bargv0);
return TRUE;
} else if (streq(argv[argi], "--usage-auxents")) {
main_usage_auxents(stdout, MLR_GLOBALS.bargv0);
return TRUE;
} else if (streq(argv[argi], "--usage-see-also")) {
main_usage_see_also(stdout, MLR_GLOBALS.bargv0);
return TRUE;
View
@@ -539,7 +539,7 @@ char* read_file_into_memory(char* filename, size_t* psize) {
int rc = fread(buffer, statbuf.st_size, 1, fp);
if (rc != 1) {
fprintf(stderr, "Unable t read content of %s\n", filename);
fprintf(stderr, "Unable to read content of %s\n", filename);
perror("fread");
fprintf(stderr, "%s: could not fread \"%s\"\n", MLR_GLOBALS.bargv0, filename);
fclose(fp);
View
@@ -90,6 +90,9 @@ def main
print make_subsection('THEN-CHAINING', [])
print make_code_block(`mlr --usage-then-chaining`)
print make_subsection('AUXILIARY COMMANDS', [])
print make_code_block(`mlr --usage-auxents`)
verbs = `mlr --list-all-verbs-raw`
print make_section('VERBS', [
""

0 comments on commit 66eb0e4

Please sign in to comment.