From 5059daf8bd59a83f520c14731173ea76ce8b8661 Mon Sep 17 00:00:00 2001 From: Hartmut Goebel Date: Sun, 8 Sep 2019 13:09:15 +0200 Subject: [PATCH] [debops-defaults] If `view` is not available, try less, etc. --- bin/debops-defaults | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/bin/debops-defaults b/bin/debops-defaults index 9dd87fe0a..3e3db4c41 100755 --- a/bin/debops-defaults +++ b/bin/debops-defaults @@ -96,13 +96,22 @@ def main(role_list): config = read_config(project_root) playbooks_path = find_playbookpath(config, project_root, required=True) - # Make sure required commands are present - require_commands('view') - - if sys.stdout.isatty(): + # Check if one of the output commands is present + sys.stdout = io.BytesIO() # suppress error message, if any + for cmd_args in (('view', '+set ft=yaml', '-'), + ('less', '-'), + ('more', '-')): + try: + require_commands(cmd_args[0]) + break + except SystemExit: + # this command was not found + cmd_args = None + sys.stdout = sys.__stdout__ + + if cmd_args and sys.stdout.isatty(): # if script is run as standalone, redirect to view - view = subprocess.Popen(['view', '+set ft=yaml', '-'], - stdin=subprocess.PIPE) + view = subprocess.Popen(cmd_args, stdin=subprocess.PIPE) try: aggregate_defaults(playbooks_path, role_list, view.stdin) except IOError as e: -- 2.21.0 f527d214d44a5df14066ce8934ef956446e4eb19'/>
path: root/gnu/packages/debian.scm
AgeCommit message (Expand)Author
2020-08-29gnu: debianutils: Update to 4.11.1....* gnu/packages/debian.scm (debianutils): Update to 4.11.1. Tobias Geerinckx-Rice
2020-07-02gnu: Add debianutils....* gnu/packages/debian.scm (debianutils): New public variable. Marius Bakke
2020-06-26gnu: debootstrap: Wrap with gpg and wget in PATH....* gnu/packages/debian.scm (debootstrap)[inputs]: Add GNUPG and WGET. Marius Bakke
2020-05-01gnu: Add apt-mirror....* gnu/packages/debian.scm (apt-mirror): New variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Jean-Baptiste Note
2020-04-13gnu: debootstrap: Update to 1.0.123....* gnu/packages/debian.scm (debootstrap): Update to 1.0.123. Tobias Geerinckx-Rice
2020-03-02gnu: debootstrap: Update to 1.0.119....* gnu/packages/debian.scm (debootstrap): Update to 1.0.119. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Vincent Legoll
2020-02-23gnu: debootstrap: Update to 1.0.118...The attached patch has been tested by creating arm64, mipsel & amd64 chroots and the amd64 one has been actually run. -- Vincent Legoll From a23b962c21e20c72f425675e6ea6e11cd0f944d0 Mon Sep 17 00:00:00 2001 From: Vincent Legoll <vincent.legoll@gmail.com> Date: Fri, 21 Feb 2020 23:34:40 +0100 Subject: [PATCH] gnu: debootstrap: Update to 1.0.118. * gnu/packages/debian.scm (debootstrap): Update to 1.0.118. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Vincent Legoll