Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Re-use CLI parser?#2882

TobiX started this conversation inIdeas
May 23, 2024· 1 comment
Discussion options

I find myself writing a lot of (reusable) one-of scripts, so it would be really nice to have all the "standard" options from the command line tool. Most of the time I useGitlab.from_config(), but that requires users of my script to create a config file to use them. What I would like is something likeGitLab.from_environment() or something, which would create a default argument parser so I could use all options of thegitlab tool for my own tools. Maybe even provide something like

parser=argparse.ArgumentParser(description="My GitLab API Tool",allow_abbrev=False)GitLab.add_arguments(parser)args=parser.parse_args()GitLab.from_environment(args=args)

which would allow to integrate all the "config" options from the command line tool into other tools.

How about it? (I might have some time to contribute the change to facilitate this, probably requires a bit of refactoring...)

(This seems a bit similar to#2830)

You must be logged in to vote

Replies: 1 comment

Comment options

We could probably extract some of the config logic out of the CLI'smain() function and then use that directly in theGitlab.merge_config() class method.

I'm personally a bit busy at the moment with other things so contributions are welcome! Will be happy to review MRs.

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Ideas
Labels
None yet
2 participants
@TobiX@nejch

[8]ページ先頭

©2009-2025 Movatter.jp