langsci / pypi

Packages for the Python Package index
2 stars 1 forks source link

feature request: make the script fixind work on various files with ending .adx rather than hardwiring main.adx #13

Closed stefan11 closed 3 years ago

stefan11 commented 4 years ago

It would be good to be able to run the script on other files than main.adx, so passing the filename as an argument or an option would be great.

Glottotopia commented 4 years ago

You can already choose the indextype you want to run the script on

python3 fixindex.py s

for subject index

python3 fixindex.py l

for language index

python3 fixindex.py a

for name index

python3 fixindex.py

also for name index

python3 fixindex.py w

for the file main.wdx, whatever that file may contain.

stefan11 commented 4 years ago

I want to use it on grammatical-theory.adx, main.adx, check-gt.adx. Currently I have to adapt the script:

    # indextypes = "a"
    # try:
    #     indextypes = sys.argv[1]
    # except IndexError:
    #     pass
    # for indextype in indextypes:
    #     processfile("main.%sdx" % indextype)

    filename = 'main.adx'
    try:
        filename = sys.argv[1]
    except IndexError:
        print("no filename given. Default is main.adx")
    processfile(filename)