magicant / yash-rs

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

Readonly builtin #320

Closed magicant closed 9 months ago

magicant commented 9 months ago

Summary by CodeRabbit

coderabbitai[bot] commented 9 months ago

The existing content is still valid, so I will repeat it verbatim:

Walkthrough

The updates across various shell built-in commands (export, readonly, typeset) involve enhanced documentation, refactoring, and improved functionality. The changes clarify command behaviors, standardize output, and introduce a new PrintContext structure for consistent handling of printing variables and functions. Code refactoring includes renaming variables for clarity and removing unnecessary wrapping in closures. Tests have been added or adjusted to align with the updated built-ins.

Changes

File Path Change Summary
yash-builtin/src/export.rs
yash-builtin/src/readonly.rs
yash-builtin/src/typeset.rs
Updated documentation, added PrintContext, refactored code, and clarified standard output behavior.
yash-builtin/src/lib.rs Simplified the execute field for the "readonly" command by removing unnecessary wrapping.
yash-builtin/src/typeset/print_...rs Added PrintContext parameter to function signatures and updated tests.
yash/tests/scripted_test.rs Added a new test function readonly_builtin.
yash/tests/scripted_test/readonly-p.sh
yash/tests/scripted_test/typeset-y.sh
Modified test scripts to reflect changes in built-in commands and removed outdated TODOs.

As autumn leaves 🍂 gently fall,
CodeRabbit 🐇 hops through the code,
Refactoring and testing with glee,
For a shell that's polished and free! 🌟


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`