pfuntner / toys

Tools and things that make my life easier - y'all might like them too
10 stars 2 forks source link

Some tools still use getopts #48

Open pfuntner opened 4 years ago

pfuntner commented 4 years ago

A lot of tools still use the getopts module so there are some inconsistencies regarding how options work between tools, some lack some features like the --help option or --foo bar and --foo=bar being synonymous, etc. A lot of tools are already using argparse but not all.

I used grep -lr getopt to get a list of the tools that use getopt and will sort them with the most desirable tools toward the top:

recentdownloads
git-extract
backup
capture.py
chainssh
cols.py
columns
comm2
datejuggle
daterep
datescope
elastic_elements
elements
elk
epochrep
feedElasticsearch
filecount
findgrep
findmetrics
getCloudant
getmetrics
gitdiff.py
gitstatus.py
grepgrep
gzsavings
headgrep
htmlize
incomingHost
ipactivity
isbinary
istext
jeval
json2table
jsonhunt
jsonjoin
manipulate
megadiff.old
megascp
megassh.py
megasum
newname
oldjson
oldjson.py
oldtable.py
procsort
pwc
pysub
qdiff
random
repeat.py
rows
sample
sanitize
seejson
sizer
table2json
tabular
tailgrep
timemachine
watcher
webwatch

Some of these I probably don't even use much anymore or have been replaced by other tools so I don't know if I'll ever hit them all. But I could get to a point where I consider the issue closed.

As I fix these, I'll remove them from the list.

This was also reported by #21 for fitwidth

pfuntner commented 3 years ago

I went ahead and fixed this issue in fitwidth along with other issues in 79fd44c but I think there are still some tools that are a problem:

$ grep -lr getopt | sort | flow --width 120
backup            capture.py        chainssh          cols              cols.py           columns          
comm2             datejuggle        daterep           datescope         elastic_elements  elements         
elk               epochrep          feedElasticsearch filecount         findgrep          findmetrics      
flow              getCloudant       getmetrics        gitdiff.py        git-extract       git-files        
gitstatus.py      grepgrep          gzsavings         headgrep          htmlize           incomingHost     
ipactivity        isbinary          istext            jeval             json2table        jsonhunt         
jsonjoin          manipulate        megadiff.old      megascp           megassh.py        megasum          
newname           oldjson           oldjson.py        oldtable.py       procsort          pwc              
pysub             qdiff             random            recentdownloads   repeat.py         rows             
sample            sanitize          seejson           sizer             table2json        tabular          
tailgrep          timemachine       watcher           webwatch                                    
$ 

I don't even think I use all of these... flow surprises me and I want to hit that one. I still regularly use newname too.

pfuntner commented 3 years ago

I gave flow a facelift with 66c3c15