Skip to content

Fix directory execution, nested tab-completion quoting, and zero-argument source evaluation#65

Merged
toumorokoshi merged 3 commits into
mainfrom
fix-directory-exec-source-args
Apr 8, 2026
Merged

Fix directory execution, nested tab-completion quoting, and zero-argument source evaluation#65
toumorokoshi merged 3 commits into
mainfrom
fix-directory-exec-source-args

Conversation

@toumorokoshi

Copy link
Copy Markdown
Owner

This PR addresses multiple issues regarding command execution logic, help parameter formatting, and shell argument inheritance in tome.

Changes Included:

  1. Directory execution correctly outputs helpful listings

    • Directory paths parsed via CommandType::Execute now evaluate to a help::help string instead of returning a generic error indicating the user executed a directory. Effectively, executing a directory is treated the same as invoking my_cmd help on that directory context natively.
    • Addressed parameter formatting positions in commands/help.rs for help_all_in_dir, which originally wrongly substituted the output templates.
  2. Tab completions successfully split nested directories

    • In commands/init.rs, the expansion argument passed into command-complete ... "$tome_args" caused bash array parameters broken by spaces to be wrapped collectively into a single argument value array block. Removed quotes ($tome_args) so complete expands array params natively line-by-line enabling nested script evaluation.
  3. Restored proper Argument inheritance isolation for sourced scripts

    • Bash and zsh natively inherit shell-level outer-arguments inside source blocks if no parameters are supplied. When executing source file.source on a zero-length argument base, .source accidentally inherited the script context bounds (e.g. $1=script_name).
    • Bound set --; via string formatting directly onto CommandType::Execute paths under tome/src/script.rs whenever targeted length maps to exactly zero on valid source scripts (Only within bash/zsh).
    • Refactored generic sourcing unit tests in src/lib_tests.rs to validate positional parameters clearing via set --; .

- Update docs to describe .tomeignore functionality
…urce execution

- Directory execution now calls `help::help` instead of returning an error string.
- Fixed `help_all_in_dir` template argument parameter order for list labels.
- Removed incorrect quotes around `` in bash completion to fix directory completion argument parsing.
- Prefixed `set --; ` for sourced scripts in bash/zsh when executed without arguments to prevent inheritance of outer positional parameters (e.g., the script name itself).
- Updated `lib_tests.rs` to accurately reflect the adjusted help outputs and the new `set --;` expectations for sourced commands.
@toumorokoshi
toumorokoshi merged commit 3516d09 into main Apr 8, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant