Skip to content

Commit

Permalink
chore: pin gum to version 0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
ctn-malone committed Oct 19, 2024
1 parent 1a1b3ce commit 1de2a5f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
6 changes: 5 additions & 1 deletion bootstrap/templates/nix/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
inputs = {
flake-utils.url = "github:numtide/flake-utils";
qjsExtLib.url = "github:ctn-malone/qjs-ext-lib";
# pin gum to version 0.12
nixpkgs-gum.url = "github:nixos/nixpkgs/5112417739f9b198047bedc352cebb41aa339e1d";
};

outputs = { self, nixpkgs, flake-utils, qjsExtLib }:
outputs = { self, nixpkgs, flake-utils, qjsExtLib, nixpkgs-gum }:
flake-utils.lib.eachSystem [ "x86_64-linux" "armv7l-linux" "aarch64-linux" ]
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
pkgs-gum = nixpkgs-gum.legacyPackages.${system};
highlight = text: "\\x1b[1;38;5;212m${text}\\x1b[0m";
qel = import (./qel.nix) {
pkgs = pkgs;
pkgs-gum = pkgs-gum;
qjsExtLib = qjsExtLib.packages.${system}.qjs-ext-lib;
};
in
Expand Down
4 changes: 2 additions & 2 deletions bootstrap/templates/nix/qel.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, qjsExtLib }:
{ pkgs, qjsExtLib, pkgs-gum }:

let
lib = pkgs.lib;
Expand Down Expand Up @@ -79,7 +79,7 @@ with pkgs; rec {
postFixup = lib.strings.concatStringsSep "\n" (map
(script:
let
deps = map (pkgName: pkgs.${pkgName}) script.runtimeDeps;
deps = map (pkgName: (if pkgName == "gum" then pkgs-gum.${pkgName} else pkgs.${pkgName})) script.runtimeDeps;
wrapCmd = ''
wrapProgram $out/bin/${script.name} \
--prefix PATH : ${lib.makeBinPath deps}
Expand Down
17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@

quickjs-static.url = "github:ctn-malone/quickjs-cross-compiler?rev=d8010afb61ef9c7d53c0bd26e65af83b83ce5e48";
flake-utils.url = "github:numtide/flake-utils";
# pin gum to version 0.12
nixpkgs-gum.url = "github:nixos/nixpkgs/5112417739f9b198047bedc352cebb41aa339e1d";
};

outputs = { self, nixpkgs, quickjs-static, flake-utils }:
outputs = { self, nixpkgs, quickjs-static, flake-utils, nixpkgs-gum }:
flake-utils.lib.eachSystem [ "x86_64-linux" "armv7l-linux" "aarch64-linux" ] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
pkgs-gum = nixpkgs-gum.legacyPackages.${system};


highlight = text: "\\x1b[1;38;5;212m${text}\\x1b[0m";

bootstrap = pkgs.writeShellApplication {
name = "qel-bootstrap.sh";
runtimeInputs = [ pkgs.gum ];
runtimeInputs = [ pkgs-gum.gum ];
text = ''
script_dir="$(cd "$(dirname "$(readlink -f "$0")")" && pwd)"
bootstrap_dir="$(realpath "$script_dir/../bootstrap")"
Expand Down Expand Up @@ -89,7 +93,7 @@
pkgs.upx
pkgs.curl
# to build interactive CLIs
pkgs.gum
pkgs-gum.gum
self.packages.${system}.qjs-ext-lib
];

Expand Down
4 changes: 2 additions & 2 deletions src/gum.js
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ export const spin = async (promise, opt) => {
};

const INPUT_DEFAULT_CHAR_LIMIT = 400;
const INPUT_DEFAULT_WIDTH = 40;
const INPUT_DEFAULT_WIDTH = 0;
const INPUT_DEFAULT_PLACEHOLDER = 'Type something...';
const INPUT_DEFAULT_PROMPT = '> ';
const INPUT_DEFAULT_CURSOR_MODE = CursorMode.BLINK;
Expand All @@ -1257,7 +1257,7 @@ const INPUT_DEFAULT_CURSOR_MODE = CursorMode.BLINK;
* @param {string} [opt.prompt="> "] - prompt to display (default = "> ") ($GUM_INPUT_PROMPT)
* @param {boolean} [opt.password=false] - mask input characters (default = false)
* @param {number} [opt.charLimit=400] - maximum value length (default = 400, 0 for no limit)
* @param {number} [opt.width=40] - input width (default = 40, 0 for terminal width) ($GUM_INPUT_WIDTH)
* @param {number} [opt.width=0] - input width (0 = terminal width) ($GUM_INPUT_WIDTH)
* @param {CustomOptions} [opt.custom]
*
* @returns {string|undefined}
Expand Down

0 comments on commit 1de2a5f

Please sign in to comment.