From 516a582439f48f6271dd3e7a33c0419ba9402682 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Thu, 21 Nov 2024 20:41:14 -0500 Subject: [PATCH] snapcraft: call `tput cols` only once during completion Signed-off-by: Simon Deziel (cherry picked from commit 55c4560d07d2646e6df67385da730934365d35d2) --- snapcraft.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snapcraft.yaml b/snapcraft.yaml index c8a6a9a9..14afb562 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -1576,8 +1576,8 @@ parts: mkdir -p "${CRAFT_PART_INSTALL}/etc/bash_completion.d/" # Snapd requires the unaliased command `lxd.lxc` to be supplied as the first command for completion to be detected set_cmds='s/^\s*complete.*__start_lxc /&lxd.lxc /' - # When executed by Snapd, the COLUMNS shell value is unset, so use $(tput cols) instead - set_cols='s/COLUMNS/$(tput cols)/' + # When executed by snapd, the COLUMNS shell value is unset, so use $(tput cols) instead + set_cols='s/# $COLUMNS.*/COLUMN="$(tput cols)" \# store the current shell width./' # When executed by snapd, the `compopt` support detection doesn't work so fake that it is always `builtin` set_compopt='s|$(type -t compopt)|"builtin"|' # Modify requestComp variable to use lxc based on context ($SNAP/bin/lxc in Snap environment)