Skip to content

Commit

Permalink
Removed get_ssid() from being the default for --ssid, fixes #41
Browse files Browse the repository at this point in the history
The issues is that `get_ssid()` gets executed even though --ssid has not
been called. This must be because it is the default value for the --ssid
argument.

By setting `get_ssid()` as the default value later in the code prevents
the dependency checking for Network Manager on Linux whenever a user
runs `wifi-password --help` to view the usage.
  • Loading branch information
sdushantha committed Feb 8, 2021
1 parent 9c412a7 commit a818597
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wifi_password/wifi_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,17 @@ def main():
parser = argparse.ArgumentParser(usage='%(prog)s [options]')
parser.add_argument('--qrcode', "-q", action="store_true", default=False, help="Generate a QR code")
parser.add_argument('--image', "-i", action="store_true", default=False, help="Create the QR code as image instead of showing it on the terminal (must be used along with --qrcode)")
parser.add_argument('--ssid', "-s", default=get_ssid(), help="Specify a SSID that you have previously connected to")
parser.add_argument('--ssid', "-s", help="Specify a SSID that you have previously connected to")
parser.add_argument('--version', action="store_true", help="Show version number")
args = parser.parse_args()

if args.version:
print(__version__)
sys.exit()

if args.ssid is None:
args.ssid = get_ssid()

password = get_password(args.ssid)

if args.qrcode:
Expand Down

0 comments on commit a818597

Please sign in to comment.