From 353da07f3bbea327121ce95af7792e3e3f95b046 Mon Sep 17 00:00:00 2001 From: cbrochtrup Date: Mon, 26 Apr 2021 21:06:39 -0500 Subject: [PATCH 1/4] Add FIRE_PAGER environment variable for PAGER functionality without affecting other programs --- fire/console/console_io.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fire/console/console_io.py b/fire/console/console_io.py index 3d3b9f81..985dbd8e 100644 --- a/fire/console/console_io.py +++ b/fire/console/console_io.py @@ -83,7 +83,11 @@ def More(contents, out, prompt=None, check_pager=True): return if check_pager: pager = encoding.GetEncodedValue(os.environ, 'PAGER', None) - if pager == '-': + fire_pager = encoding.GetEncodedValue(os.environ, 'FIRE_PAGER', None) + if fire_pager: + # FIRE_PAGER takes precedence to PAGER + pager = fire_pager + elif pager == '-': # Use the fallback Pager. pager = None elif not pager: From 12e3d9e116859ac90d8a668f835eef1b8a1478ad Mon Sep 17 00:00:00 2001 From: cbrochtrup Date: Mon, 26 Apr 2021 21:06:51 -0500 Subject: [PATCH 2/4] Document FIRE_PAGER --- docs/using-cli.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/using-cli.md b/docs/using-cli.md index 0f369a9a..c37dacf9 100644 --- a/docs/using-cli.md +++ b/docs/using-cli.md @@ -170,6 +170,10 @@ displayed. The displayed help shows information about which Python component your command corresponds to, as well as usage information for how to extend that command. +The environment variable, `FIRE_PAGER`, sets the default pager for help text +to the preferred program. For example, set `FIRE_PAGER=cat` to print help text +on standard out. + ### `--trace`: Getting a Fire trace From 55fe6e6ce1160faac4dc247982a203ea39f6611f Mon Sep 17 00:00:00 2001 From: Colin Brochtrup Date: Mon, 3 May 2021 21:22:16 -0500 Subject: [PATCH 3/4] Update fire/console/console_io.py --- fire/console/console_io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fire/console/console_io.py b/fire/console/console_io.py index 985dbd8e..c1f5c7fc 100644 --- a/fire/console/console_io.py +++ b/fire/console/console_io.py @@ -87,7 +87,7 @@ def More(contents, out, prompt=None, check_pager=True): if fire_pager: # FIRE_PAGER takes precedence to PAGER pager = fire_pager - elif pager == '-': + if pager == '-': # Use the fallback Pager. pager = None elif not pager: From 8f113c9a80bc7f571ac4e6c183100b32e0ae0a4f Mon Sep 17 00:00:00 2001 From: cbrochtrup Date: Mon, 3 May 2021 21:23:53 -0500 Subject: [PATCH 4/4] Update docs with a more portalbe command. --- docs/using-cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/using-cli.md b/docs/using-cli.md index c37dacf9..479cf7f8 100644 --- a/docs/using-cli.md +++ b/docs/using-cli.md @@ -171,7 +171,7 @@ The displayed help shows information about which Python component your command corresponds to, as well as usage information for how to extend that command. The environment variable, `FIRE_PAGER`, sets the default pager for help text -to the preferred program. For example, set `FIRE_PAGER=cat` to print help text +to the preferred program. For example, set `FIRE_PAGER=-` to print help text on standard out.