magicant / yash-rs

Reimplementation of yash, an extended POSIX shell
64 stars 3 forks source link

Source built-in #324

Closed magicant closed 9 months ago

magicant commented 9 months ago

Implements the . built-in for POSIX conformance.

Summary by CodeRabbit

coderabbitai[bot] commented 9 months ago

Walkthrough

The yash shell has been updated to include the source built-in command, allowing users to execute commands from a file within the current shell environment. This feature is gated by the yash-semantics feature flag. The update includes parsing logic, error handling, environment stack adjustments, and new tests to ensure the functionality works as expected.

Changes

File Path Change Summary
yash-builtin/src/lib.rs Added source module and command, conditional on yash-semantics feature.
yash-builtin/src/source.rs
yash-builtin/src/source/semantics.rs
yash-builtin/src/source/syntax.rs
Implemented source built-in command with parsing, execution logic, and error handling.
yash-env/src/stack.rs Added DotScript variant to Frame enum and updated loop_count method.
yash-syntax/src/source.rs
yash-syntax/src/source/pretty.rs
Updated Source enum with DotScript variant and display logic.
yash/tests/scripted_test.rs
yash/tests/scripted_test/source-p.sh
Added new tests for the source built-in functionality.
yash/tests/scripted_test/redir-p.sh
yash/tests/scripted_test/return-p.sh
Script changes related to built-in commands and test cases.

🐇✨ In the shell of yash, a new dawn breaks, 'source' command, a journey it takes. Files come alive with a dot and a name, CodeRabbit hops on, acclaiming its fame. 🎉 ✨🐇


Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) - If you reply to a *review comment* from CodeRabbit, the bot will automatically respond. - To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment - Note: Review comments are made on code diffs or files, not on the PR overview. - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Note: For conversation with the bot, please use the review comments on code diffs or files. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json). - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`