Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build the OptParser in its own method #330

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions youtube_upload/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ def run_main(parser, options, args, output=sys.stdout):
raise AuthenticationError("Cannot get youtube resource")


def main(arguments):
"""Upload videos to Youtube."""
def build_parser():
"""Build and return the CLI parser."""
usage = """Usage: %prog [OPTIONS] VIDEO [VIDEO2 ...]

Upload videos to Youtube."""
Expand Down Expand Up @@ -272,7 +272,13 @@ def main(arguments):
default=1024 * 1024 * 8, help='Update file chunksize')
parser.add_option('', '--open-link', dest='open_link', action='store_true',
help='Opens a url in a web browser to display the uploaded video')

return parser


def main(arguments):
"""Upload videos to Youtube."""
parser = build_parser()
options, args = parser.parse_args(arguments)

if options.description_file is not None and os.path.exists(options.description_file):
Expand Down