Closed theChaosCoder closed 3 years ago
Sure, make it an optional argument then.
Now -g is optional
Yeah but it is broken now :D
Try python vsrupdate.py -p lsmas update-local -o
This line fixes it
apifile = json.loads(fetch_url(get_git_api_url(pfile['github']), pfile['name'], token=args.git_token[0] if args.git_token else None))
What I don't like is that args.git_token is a list. haven't figured out yet what to change in argparse in order to get a single value.
Commit your fix then. I think the list thing is simply how the arg parsing works.
Done. I will investigate further. I think it should be possible to get a single value instead of a list.
Ok it seems you just need to remove nargs=1 and it is a single value then. nargs = always a list.
I think the only place where the git token is really necessary is the "mass update" function, to ensure one does not get blocked by github.
It is an unnecessary obstacle for people who only want to contribute a small package fix/update.
For updating single packages this should be ok:
python vsrupdate.py -p akarin update-local -o
Currently the token is always mandatory:
python vsrupdate.py -p akarin update-local -o -g your-github-token
The fetch_url function already supports calls without a token: https://github.com/vapoursynth/vsrepo/blob/ca5d6049b43c1dd3dff0d2f8005382d1c7d10c37/vsrupdate.py#L93
And I think this is the only place where a check would be necessary theoretically: https://github.com/vapoursynth/vsrepo/blob/ca5d6049b43c1dd3dff0d2f8005382d1c7d10c37/vsrupdate.py#L234