Skip to content

Commit

Permalink
allow --asciitab and have --noheaders with -D short
Browse files Browse the repository at this point in the history
  • Loading branch information
gdraheim committed Aug 1, 2024
1 parent 7106b44 commit db60216
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions tabtotext.py
Original file line number Diff line number Diff line change
Expand Up @@ -2983,11 +2983,13 @@ def tabFileToPrintWith(filename: str, fileformat: str, output: str = NIX, fmt: s
help="override cell padding for format")
cmdline.add_option("-t", "--tabulator", metavar="C", default=None,
help="override tabulator for format")
cmdline.add_option("-T", "--notab", action="store_true", default=False,
cmdline.add_option("-T", "--asciitab", action="store_true", default=False,
help="use ascii HT tabulator (csv,md,tab,wide)")
cmdline.add_option("-N", "--notab", action="store_true", default=False,
help="do not use tabulator (csv,md,tab,wide)")
cmdline.add_option("-P", "--nopadding", action="store_true", default=False,
help="do not use padding (csv,md,tab,wide,html)")
cmdline.add_option("-N", "--noheaders", action="store_true", default=False,
cmdline.add_option("-D", "--noheaders", action="store_true", default=False,
help="do not print headers (csv,md,tab,wide)")
cmdline.add_option("-U", "--unique", action="store_true", default=False,
help="remove same lines in sorted list (csv,md,...)")
Expand All @@ -3011,7 +3013,7 @@ def tabFileToPrintWith(filename: str, fileformat: str, output: str = NIX, fmt: s
selected = opt.labels
minwidth = int(opt.minwidth)
padding = opt.padding if not opt.nopadding else ""
tab = opt.tabulator if not opt.notab else ""
tab = "\t" if opt.asciitab else opt.tabulator if not opt.notab else ""
tabtext = tabtextfile(filename, opt.inputformat)
done = print_tabtotext(opt.output, tabtext.data, tabtext.headers, selected,
datedelim=opt.datedelim, tab=tab, padding=padding,
Expand Down
8 changes: 5 additions & 3 deletions tabxlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,11 +1155,13 @@ def extension(filename: str) -> Optional[str]:
help="override cell padding for format")
cmdline.add_option("-t", "--tabulator", metavar="C", default=None,
help="override tabulator for format")
cmdline.add_option("-T", "--notab", action="store_true", default=False,
cmdline.add_option("-T", "--asciitab", action="store_true", default=False,
help="use ascii HT tabulator (csv,md,tab,wide)")
cmdline.add_option("-N", "--notab", action="store_true", default=False,
help="do not use tabulator (csv,md,tab,wide)")
cmdline.add_option("-P", "--nopadding", action="store_true", default=False,
help="do not use padding (csv,md,tab,wide)")
cmdline.add_option("-N", "--noheaders", action="store_true", default=False,
cmdline.add_option("-D", "--noheaders", action="store_true", default=False,
help="do not print headers (csv,md,tab,wide)")
cmdline.add_option("-U", "--unique", action="store_true", default=False,
help="remove same lines in sorted --labels")
Expand Down Expand Up @@ -1187,7 +1189,7 @@ def extension(filename: str) -> Optional[str]:
sys.exit(1)
minwidth = int(opt.minwidth)
padding = opt.padding if not opt.nopadding else ""
tab = opt.tabulator if not opt.notab else ""
tab = "\t" if opt.asciitab else opt.tabulator if not opt.notab else ""
filename = args[0]
tabtext = tabtextfile(filename, defaultformat="xlsx")
logg.debug("headers = %s", tabtext.headers)
Expand Down

0 comments on commit db60216

Please sign in to comment.