Merge branch 'develop'
Some checks failed
Pull Request / spec (push) Has been cancelled
Pull Request / benchmark (push) Has been cancelled

This commit is contained in:
Jorge Morante 2026-06-09 11:00:08 +01:00
commit fc3c750b8d
7 changed files with 53 additions and 5 deletions

View file

@ -1,3 +1,9 @@
## 2.7.1 - 09 Jun 2026
* fix parsing of @fingers-enabled-builtin-patterns ( Fixes #176 )
* update install-wizard and readme to show that shards is required
* relax parsing of --patterns flag in cli
## 2.7.0 - 31 May 2026
* improved performance: ~30% faster

View file

@ -31,8 +31,8 @@ trap finish EXIT
function install_from_source() {
echo "Installing from source..."
# check if shards is installed
if ! command -v shards >/dev/null 2>&1; then
# check if crystal is installed
if ! command -v crystal >/dev/null 2>&1; then
echo "crystal is not installed. Please install it first."
echo ""
echo " https://crystal-lang.org/install/"
@ -40,6 +40,15 @@ function install_from_source() {
exit 1
fi
# check if shards is installed
if ! command -v shards >/dev/null 2>&1; then
echo "shards is not installed. Please install it first."
echo ""
echo " https://crystal-lang.org/reference/latest/man/shards/index.html"
echo ""
exit 1
fi
pushd $CURRENT_DIR > /dev/null
WIZARD_INSTALLATION_METHOD=build-from-source shards build --production
popd > /dev/null

View file

@ -1,5 +1,5 @@
---
version: 2.7.0
version: 2.7.1
name: fingers
authors:
- Jorge Morante <jorge@morante.eu>

View file

@ -13,7 +13,7 @@ define_bool_option :skip_wizard, false
define_enum_option :hint_position, %w(left right), "left"
define_enum_option :keyboard_layout, Fingers::ALPHABET_MAP.keys, "qwerty"
define_enum_option :enabled_builtin_patterns, ["all", *Fingers::BUILTIN_PATTERNS.keys], "all"
define_multi_enum_option :enabled_builtin_patterns, ["all", *Fingers::BUILTIN_PATTERNS.keys], "all"
define_action_option :main, ":copy:"
define_action_option :ctrl, ":open:"

View file

@ -76,6 +76,20 @@ macro define_enum_option(name, possible_values, default)
end
end
macro define_multi_enum_option(name, possible_values, default)
module Fingers::Options
class {{name.camelcase.id}} < Base
include ::Fingers::Options::Parsers::MultiEnumParser
DEFAULT = {{ default }}
alias Type = String
def possible_values
{{ possible_values }}
end
end
end
end
macro define_key_option(name, default)
module Fingers::Options
class {{name.camelcase.id}} < Base

View file

@ -0,0 +1,19 @@
module Fingers::Options::Parsers::MultiEnumParser
def valid?(value : String) : Tuple(Bool, String)
invalid = value.split(",").reject { |name| possible_values_as_strings.includes?(name) }
if invalid.empty?
{ true, "ok" }
else
{ false, "Invalid value(s) '#{invalid.join(",")}'. Possible values are: #{possible_values.join(", ")}" }
end
end
def possible_values
[] of String
end
def possible_values_as_strings
possible_values.map { |value| value.to_s }
end
end

View file

@ -7,7 +7,7 @@ module Fingers::Options
def parse(raw_value : String, option_name : String)
val = {} of String => String
val[option_name.gsub(/^pattern-/, "")] = raw_value
val[option_name.gsub(/^pattern[-_]/, "")] = raw_value
val
end