I have nothing to directly comment on the tutorial. Just a tangential mention regarding the tedious argument parsing boilerplate in Python, I have found Python Fire to be much more convenient: https://github.com/google/python-fire It would have shaved off another 15-20 lines from the 503 line example ;-)
Write yourself a Git (2018)
11–20 of 111 posts
Re: Write yourself a Git (2018)
#12I have nothing to directly comment on the tutorial. Just a tangential mention regarding the tedious argument parsing boilerplate in Python, I have found Python Fire to be much more convenient: https://github.com/google/python-fire It would have shaved off another 15-20 lines from the 503 line example ;-)
Re: Write yourself a Git (2018)
#13Re: Write yourself a Git (2018)
#14I have nothing to directly comment on the tutorial. Just a tangential mention regarding the tedious argument parsing boilerplate in Python, I have found Python Fire to be much more convenient: https://github.com/google/python-fire It would have shaved off another 15-20 lines from the 503 line example ;-)
Python Fire looks much more concise. But do you know of any other languages that handles argument parsing better then Python ?
Re: Write yourself a Git (2018)
#15I have nothing to directly comment on the tutorial. Just a tangential mention regarding the tedious argument parsing boilerplate in Python, I have found Python Fire to be much more convenient: https://github.com/google/python-fire It would have shaved off another 15-20 lines from the 503 line example ;-)
Python Fire looks much more concise. But do you know of any other languages that handles argument parsing better then Python ?
Re: Write yourself a Git (2018)
#16Re: Write yourself a Git (2018)
#17I have nothing to directly comment on the tutorial. Just a tangential mention regarding the tedious argument parsing boilerplate in Python, I have found Python Fire to be much more convenient: https://github.com/google/python-fire It would have shaved off another 15-20 lines from the 503 line example ;-)
Click => command line interface creation kit.
Ironic little name...
Re: Write yourself a Git (2018)
#18Re: Write yourself a Git (2018)
#19I have nothing to directly comment on the tutorial. Just a tangential mention regarding the tedious argument parsing boilerplate in Python, I have found Python Fire to be much more convenient: https://github.com/google/python-fire It would have shaved off another 15-20 lines from the 503 line example ;-)
import argparse
def add_file(file):
print('Added ' + file)
def main():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(title='Sub Commands')
# add parser
add_parser = subparsers.add_parser('add', help='Add a file')
add_parser.add_argument('file', help='File to add')
add_parser.set_defaults(func=lambda args: add_file(args.file))
args = parser.parse_args()
args.func(args)
[1] https://docs.python.org/3/library/argparse.html#sub-commandsRe: Write yourself a Git (2018)
#20It also takes a ground-up "build it yourself" approach and has tons of interesting detail.