Skip to content

Instantly share code, notes, and snippets.

@maximpertsov
Created January 8, 2018 21:40
Show Gist options
  • Save maximpertsov/463bef57a5dbdcb3a5728d1ca84a1afc to your computer and use it in GitHub Desktop.
Save maximpertsov/463bef57a5dbdcb3a5728d1ca84a1afc to your computer and use it in GitHub Desktop.
Partially convert Django management commands from optparse style to argparse style
ag -l make_option | while read -r FILE; do cat $FILE | sed -i -e '/option_list/d' -e '/import make_option/d' -e 's/ make_option/parser.add_argument/g' -e 's/),\s*$/)/g' -e '0,/^\s*)\(,\|\)\s*$/{/^\s*)\(,\|\)\s*$/d}' -e '/args = "/d' $FILE; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment