From a4e6d0597cca1526fa2550f7de2043ec676d8a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Wed, 27 Aug 2025 14:13:08 +0200 Subject: [PATCH] refactor(bin): mise-config script now uses fd --- .local/bin/mc | 23 ----------------------- .local/bin/mise-config | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 23 deletions(-) delete mode 100755 .local/bin/mc create mode 100755 .local/bin/mise-config diff --git a/.local/bin/mc b/.local/bin/mc deleted file mode 100755 index 07ab83e0..00000000 --- a/.local/bin/mc +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -TEMPLATE_DIR="$XDG_CONFIG_HOME/mise/templates" -MISE_CONFIG=".mise.toml" - -if [ ! -d "$TEMPLATE_DIR" ]; then - exit 1 -fi - -selected_file=$(find "$TEMPLATE_DIR" -name "*.toml" -print0 | - xargs -0 -n 1 basename | sed 's/\.toml$//' | - fzf --preview "bat --style=numbers --color=always $TEMPLATE_DIR/{}.toml" \ - --prompt="Select a template file: ") - -if [ -z "$selected_file" ]; then - exit 1 -fi - -if [ -f "$MISE_CONFIG" ]; then - cat "$TEMPLATE_DIR/$selected_file.toml" >>"$MISE_CONFIG" -else - cp "$TEMPLATE_DIR/$selected_file.toml" "$MISE_CONFIG" -fi diff --git a/.local/bin/mise-config b/.local/bin/mise-config new file mode 100755 index 00000000..4887b4f6 --- /dev/null +++ b/.local/bin/mise-config @@ -0,0 +1,18 @@ +#!/bin/bash + +TEMPLATE_DIR="$XDG_CONFIG_HOME/mise/templates" +MISE_CONFIG=".mise.toml" + +if [ ! -d "$TEMPLATE_DIR" ]; then + exit 1 +fi + +selected_file=$(fd . "$TEMPLATE_DIR" -e toml -x basename {} | + fzf --preview "bat $TEMPLATE_DIR/{}" \ + --prompt="Select a template file: ") + +if [ -z "$selected_file" ]; then + exit 1 +fi + +cp -i "$TEMPLATE_DIR/$selected_file" "$MISE_CONFIG"