Changed usage display to be table (tuple) driven for ease of maintenance
1 parent d66fe90 commit 1d3b88d826c034579b287e27a24611717cecacd7
@tundra tundra authored on 26 Jun 2001
Showing 1 changed file
View
36
tdir
import sys
 
# Version info
 
VERSION = "$Id: tdir,v 1.55 2001/06/24 19:00:24 tundra Exp $"
VERSION = "$Id: tdir,v 1.56 2001/06/27 02:02:44 tundra Exp $"
 
 
# Booleans
 
DisplayOutput(dir, DirList, FileList)
 
 
def Usage():
sys.stdout.write("tdir - Copyright (c) 2001, TundraWare Inc., All Rights Reserved. \n\n")
sys.stdout.write(" usage: tdir [-Rdfhtv] [-c #] [-s c] [-w #] [dir...] where,\n\n")
sys.stdout.write(" -R Recurse down each named directory tree\n")
sys.stdout.write(" -c # Column width\n")
sys.stdout.write(" -d Do not display directories in output\n")
sys.stdout.write(" -f Do not display files in output\n")
sys.stdout.write(" -h Display this help information\n")
sys.stdout.write(" -s c Separator character\n")
sys.stdout.write(" -t Display only the directory tree - same as -Rdf\n")
sys.stdout.write(" -v Display tdir version information\n")
sys.stdout.write(" -w # Width of output\n")
sys.stdout.write(" dir... List of directories to display. Defaults to ./\n")
UsageInfo = (
("tdir - Copyright (c) 2001, TundraWare Inc., All Rights Reserved. \n", ""),
(" usage: tdir [-Rdfhtv] [-c #] [-s c] [-w #] [dir...] where,\n\n", ""),
("-R", "Recurse down each named directory tree\n"),
("-c #", "Column width\n"),
("-d", "Do not display directories in output\n"),
("-f", "Do not display files in output\n"),
("-h", "Display this help information\n"),
("-s c", "Separator character\n"),
("-t", "Display only the directory tree - same as -Rdf\n"),
("-v", "Display tdir version information\n"),
("-w #", "Width of output\n"),
("dir...", "List of directories to display. Defaults to ./\n")
)
 
for x, y in UsageInfo:
if len(x) < 10: # Only indent for the actual argument info
sys.stdout.write(10 * PAD)
sys.stdout.write(x)
sys.stdout.write((8 - len(x)) * PAD)
sys.stdout.write(y)
 
# Program entry and command line processing
 
try: