mirror of
https://github.com/cheat/cheat.git
synced 2024-11-25 23:41:36 +01:00
ba47dc2cbc
- Added `ci/lint.sh`, which uses `flake8` to lint the relevant files - Made changes to appease the linter. - Bugfix in `cheat/configuration` (missing dependency)
27 lines
681 B
Python
27 lines
681 B
Python
from __future__ import print_function
|
|
import sys
|
|
|
|
|
|
class Utils:
|
|
|
|
@staticmethod
|
|
def die(message):
|
|
""" Prints a message to stderr and then terminates """
|
|
Utils.warn(message)
|
|
exit(1)
|
|
|
|
@staticmethod
|
|
def warn(message):
|
|
""" Prints a message to stderr """
|
|
print((message), file=sys.stderr)
|
|
|
|
@staticmethod
|
|
def boolify(value):
|
|
""" Type-converts 'true' and 'false' to Booleans """
|
|
# if `value` is not a string, return it as-is
|
|
if not isinstance(value, str):
|
|
return value
|
|
|
|
# otherwise, convert "true" and "false" to Boolean counterparts
|
|
return value.strip().lower() == "true"
|