From 0d497156ccdd212b9b42157d5641a0fa969c683e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Wed, 11 Jun 2025 13:52:54 +0200 Subject: [PATCH] feat(bin): script to clone mise configuration to a certain dir --- .local/bin/mc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 .local/bin/mc diff --git a/.local/bin/mc b/.local/bin/mc new file mode 100755 index 00000000..07ab83e0 --- /dev/null +++ b/.local/bin/mc @@ -0,0 +1,23 @@ +#!/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