Skip to content

Commit e1fc48b

Browse files
committed
Add env variable support
1 parent ea973a3 commit e1fc48b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tldr.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,15 @@ def main() -> None:
640640
parser = create_parser()
641641

642642
options = parser.parse_args()
643-
644-
short = options.shortform
645-
long = options.longform
643+
short = False
644+
long = False
645+
if not (options.shortform or options.longform):
646+
short = int(os.environ.get('TLDR_SHORTFORM', '0')) > 0
647+
long = int(os.environ.get('TLDR_LONGFORM', '0')) > 0
648+
elif options.shortform:
649+
short = True
650+
elif options.longform:
651+
long = True
646652
colorama.init(strip=options.color)
647653
if options.color is False:
648654
os.environ["FORCE_COLOR"] = "true"

0 commit comments

Comments
 (0)