Use argparse special features to handle displaying version info (#486)

* Use argparse special features to handle displaying version info

* Remove version argument check from spotdl.py
This commit is contained in:
Ritiek Malhotra
2019-01-21 05:56:21 -08:00
committed by GitHub
parent 3dac0125a9
commit a182fe5eb3
2 changed files with 4 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ import argparse
import mimetypes
import os
import spotdl
from spotdl import internals
@@ -120,9 +121,6 @@ def get_arguments(raw_args=None, to_group=True, to_merge=True):
"--username",
help="load tracks from user's playlist into <playlist_name>.txt",
)
group.add_argument(
"-V", "--version", help="show version and exit", action="store_true"
)
parser.add_argument(
"--write-m3u",
@@ -257,6 +255,9 @@ def get_arguments(raw_args=None, to_group=True, to_merge=True):
parser.add_argument(
"-c", "--config", default=None, help="path to custom config.yml file"
)
parser.add_argument(
"-V", "--version", action="version", version="%(prog)s {}".format(spotdl.__version__)
)
parsed = parser.parse_args(raw_args)

View File

@@ -49,10 +49,6 @@ def match_args():
def main():
const.args = handle.get_arguments()
if const.args.version:
print("spotdl {version}".format(version=__version__))
sys.exit()
internals.filter_path(const.args.folder)
youtube_tools.set_api_key()