Skip to content

Commit

Permalink
use locale-independent sorting of function names
Browse files Browse the repository at this point in the history
  • Loading branch information
laniakea64 committed Jul 15, 2024
1 parent 3cec351 commit bf05bd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ update-last-changed *force:
sed --in-place -E -e "s/(^\\S+\\s*Last\\s+Change:\\s+).+$/\\1${lastchange}/g" "$f"
done


just_boolean_settings := """
allow-duplicate-recipes
allow-duplicate-variables
Expand All @@ -74,10 +75,10 @@ just_boolean_settings := """
windows-powershell
"""


# Some functions are intentionally omitted from these lists because they're handled as special cases:
# Newline-separated list of `just` functions.
# Some functions are intentionally omitted from this list because they're handled as special cases:
# - error
allFunctions := replace_regex('''
just_functions := replace_regex('''
absolute_path
append
arch
Expand Down Expand Up @@ -108,9 +109,9 @@ allFunctions := replace_regex('''
is_dependency
join
just_executable
just_pid
justfile
justfile_directory
just_pid
kebabcase
lowercamelcase
lowercase
Expand Down Expand Up @@ -146,10 +147,10 @@ allFunctions := replace_regex('''
uppercase
uuid
without_extension
''', '(?m)^(.+)_directory(_native)?$', "${1}_dir$2\n$0")
''', '(?m)^(.*)_directory(_native)?$', "${1}_dir$2\n$0")

@functions:
{{justq}} --evaluate allFunctions | sort | tr '\n' ' ' | sed -E -e 's/\s+$/\n/g'
echo -n {{quote(just_functions)}} | LC_ALL=C sort | tr '\n' ' ' | sed -E -e 's/\s+$/\n/g'

# generate an optimized Vim-style "very magic" regex snippet from a list of literal strings to match
optrx +strings:
Expand Down
2 changes: 1 addition & 1 deletion syntax/just.vim
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ syn match justFunctionCall "\v\w+%(\s|\\\n)*\(@=" transparent contains=justBuilt

" error() is intentionally not included in this list
syn keyword justBuiltInFunction
\ absolute_path append arch blake3 blake3_file cache_dir cache_directory canonicalize capitalize choose clean config_dir config_directory config_local_dir config_local_directory data_dir data_directory data_local_dir data_local_directory datetime datetime_utc encode_uri_component env env_var env_var_or_default executable_dir executable_directory extension file_name file_stem home_dir home_directory invocation_dir invocation_directory invocation_directory_native invocation_dir_native is_dependency join just_executable justfile justfile_dir justfile_directory just_pid kebabcase lowercamelcase lowercase module_dir module_directory module_file num_cpus os os_family parent_dir parent_directory path_exists prepend quote replace replace_regex semver_matches sha256 sha256_file shell shoutykebabcase shoutysnakecase snakecase source_dir source_directory source_file titlecase trim trim_end trim_end_match trim_end_matches trim_start trim_start_match trim_start_matches uppercamelcase uppercase uuid without_extension
\ absolute_path append arch blake3 blake3_file cache_dir cache_directory canonicalize capitalize choose clean config_dir config_directory config_local_dir config_local_directory data_dir data_directory data_local_dir data_local_directory datetime datetime_utc encode_uri_component env env_var env_var_or_default executable_dir executable_directory extension file_name file_stem home_dir home_directory invocation_dir invocation_dir_native invocation_directory invocation_directory_native is_dependency join just_executable just_pid justfile justfile_dir justfile_directory kebabcase lowercamelcase lowercase module_dir module_directory module_file num_cpus os os_family parent_dir parent_directory path_exists prepend quote replace replace_regex semver_matches sha256 sha256_file shell shoutykebabcase shoutysnakecase snakecase source_dir source_directory source_file titlecase trim trim_end trim_end_match trim_end_matches trim_start trim_start_match trim_start_matches uppercamelcase uppercase uuid without_extension
\ contained

syn match justUserDefinedError "\v%(assert|error)%(%(\s|\\\n)*\()@="
Expand Down

0 comments on commit bf05bd1

Please sign in to comment.