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

@deprecated warning display can be toggled off #795

Merged
merged 2 commits into from
Jan 18, 2022
Merged
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: 6 additions & 4 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,11 @@ def deprecated(solution: str = "") -> Callable:
def decorator(f: Callable) -> Callable:
@functools.wraps(f)
def wrapper(*args: Tuple, **kwargs: Dict) -> Any:
msg = f"'{f.__name__}' is deprecated and will be removed in a feature release. "
if solution:
msg += solution
warn(msg)
if gef.config["gef.show_deprecation_warnings"] is True:
msg = f"'{f.__name__}' is deprecated and will be removed in a feature release. "
if solution:
msg += solution
warn(msg)
return f(*args, **kwargs)

if not wrapper.__doc__:
Expand Down Expand Up @@ -10480,6 +10481,7 @@ def __init__(self) -> None:
gef.config["gef.extra_plugins_dir"] = GefSetting("", str, "Autoload additional GEF commands from external directory")
gef.config["gef.disable_color"] = GefSetting(False, bool, "Disable all colors in GEF")
gef.config["gef.tempdir"] = GefSetting(GEF_TEMP_DIR, str, "Directory to use for temporary/cache content")
gef.config["gef.show_deprecation_warnings"] = GefSetting(True, bool, "Toggle the display of the `deprecated` warnings")
self.loaded_commands = []
self.loaded_functions = []
self.missing_commands = {}
Expand Down