Skip to content

Commit

Permalink
Move to new global variables system
Browse files Browse the repository at this point in the history
  • Loading branch information
GhostofGoes committed Oct 13, 2023
1 parent ff0fe60 commit 4cd2ede
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 256 deletions.
2 changes: 1 addition & 1 deletion getmac/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .getmac import __version__, get_mac_address # noqa: F401
from .getmac import __version__, settings, get_mac_address # noqa: F401

__all__ = ["get_mac_address"]
13 changes: 7 additions & 6 deletions getmac/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys

from . import getmac
from .variables import settings, gvars


def main() -> None:
Expand Down Expand Up @@ -86,20 +87,20 @@ def main() -> None:
)

if args.debug:
getmac.DEBUG = args.debug
settings.DEBUG = args.debug

if args.override_port:
port = int(args.override_port)
getmac.log.debug(
"Using UDP port %d (overriding the default port %d)", port, getmac.PORT
gvars.log.debug(
"Using UDP port %d (overriding the default port %d)", port, settings.PORT
)
getmac.PORT = port
settings.PORT = port

if args.override_platform:
getmac.OVERRIDE_PLATFORM = args.override_platform.strip().lower()
settings.OVERRIDE_PLATFORM = args.override_platform.strip().lower()

if args.force_method:
getmac.FORCE_METHOD = args.force_method.strip().lower()
settings.FORCE_METHOD = args.force_method.strip().lower()

mac = getmac.get_mac_address(
interface=args.interface,
Expand Down
Loading

0 comments on commit 4cd2ede

Please sign in to comment.