Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix prompt dialog and setup issues #15

Merged
merged 3 commits into from
Mar 22, 2024
Merged

Fix prompt dialog and setup issues #15

merged 3 commits into from
Mar 22, 2024

Conversation

mmena1
Copy link
Owner

@mmena1 mmena1 commented Mar 22, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new environment handling mechanism to improve user experience in development mode.
    • Enhanced user prompts across various setup scripts for dotfiles, system packages, and application installations, including Docker, SSH keys, 1Password, VSCode, Fira Code NerdFont, GitHub CLI, and "eza".
    • Simplified the process for setting up passwordless sudo configurations.
    • Streamlined the installation process for tmux configuration, Homebrew, and other essential tools.
    • Improved the logic for retrieving default branch information from remote repositories in Git configurations.
  • Refactor

    • Refined conditional checks and user input handling across numerous scripts for better clarity and efficiency.
    • Updated the prompt function to handle user input more effectively based on the development environment setting.

Copy link
Contributor

coderabbitai bot commented Mar 22, 2024

Walkthrough

The updates across various scripts and configurations introduce a more streamlined approach to user interactions and system setup processes. By leveraging a conditional logic that hinges on user responses and environmental settings, the changes enhance the flexibility and user-friendliness of setup scripts. The introduction of a .dev variable and direct use of the prompt function across scripts for different setups like Docker, tmux, SSH keys, and more, simplifies the process, making it more intuitive and efficient.

Changes

Files Summary
home/.../.chezmoi.toml.tmpl Introduced $dev variable to manage environment settings and email address logic.
home/.../run_before_00-intro.sh.tmpl Updated user prompts and conditional checks in setup script.
home/.../run_once_after_...-passwordless-sudo.sh.tmpl, ...-tmux-conf.sh.tmpl, ...-asdf-install.sh.tmpl, ...-docker-setup.sh.tmpl, ...-ssh-keys.sh.tmpl, ...-1password-setup.sh.tmpl, ...-vscode-setup.sh.tmpl, ...-font-fira-code-setup.sh.tmpl, ...-gh-cli-setup.sh.tmpl, ...-eza-setup.sh.tmpl, ...-install-homebrew.sh.tmpl Simplified conditional checks and user prompts for various setups using the prompt function.
home/.chezmoitemplates/common Modified prompt function to handle user input based on .dev variable.
home/.../__git.default_branch.fish Revised function to fetch default branch info from remote repository.

🐇✨
In the land of code and script,
Where changes flow and merge so swift.
A rabbit hopped, with tweaks so fine,
Streamlining prompts, with design divine.
"To make things simple," it said with glee,
Is a hop, a skip, for you and me!
🌟🐾

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.
  • 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

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 05cd2d2 and 0ebc540.
Files selected for processing (15)
  • home/.chezmoi.toml.tmpl (2 hunks)
  • home/.chezmoiscripts/run_before_00-intro.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_00-passwordless-sudo.sh.tmpl (3 hunks)
  • home/.chezmoiscripts/run_once_after_01-tmux-conf.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_02-asdf-install.sh.tmpl (2 hunks)
  • home/.chezmoiscripts/run_once_after_03-docker-setup.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_04-ssh-keys.sh.tmpl (3 hunks)
  • home/.chezmoiscripts/run_once_after_06_1password-setup.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_07_vscode-setup.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_09-font-fira-code-setup.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_10-gh-cli-setup.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_11_eza-setup.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_before_01-install-homebrew.sh.tmpl (1 hunks)
  • home/.chezmoitemplates/common (1 hunks)
  • home/private_dot_config/private_fish/functions/__git.default_branch.fish (1 hunks)
Additional comments: 21
home/.chezmoi.toml.tmpl (3)
  • 1-1: The introduction of the $dev variable to handle the "dev" environment configuration is a good practice for managing different environments. This change allows for more flexible script execution based on the environment.
  • 3-3: The logic for setting the email address now correctly checks the $dev variable instead of directly checking the environment variable. This change aligns with the objective of refining user interaction and simplifies the conditional logic.
  • 15-15: Including the dev variable in the [data] section is a useful addition for templates that might need to conditionally render content based on the development environment. This enhances the modularity and flexibility of the configuration.
home/.chezmoiscripts/run_before_00-intro.sh.tmpl (3)
  • 1-1: The conditional check at the beginning of the script ensures that the script only runs in a development environment. This is consistent with the PR's objective to refine user interaction and script efficiency.
  • 8-9: Simplifying the user confirmation process by directly using the prompt function's return value is a good practice. It eliminates the need for intermediate variable assignments and makes the script more readable and maintainable.
  • 15-15: Continuing the practice of directly using the prompt function's return value for conditional checks enhances the script's simplicity and efficiency. This change aligns with the PR's objectives.
home/.chezmoiscripts/run_once_after_07_vscode-setup.sh.tmpl (1)
  • 8-8: Directly using the prompt function for the conditional check to install VSCode simplifies the script and aligns with the PR's goal of enhancing user interaction. This approach makes the script more concise and readable.
home/.chezmoiscripts/run_once_after_03-docker-setup.sh.tmpl (1)
  • 7-7: The modification to use a direct prompt for enabling Docker and adding the user to the Docker group simplifies the script and improves user interaction. This change is consistent with the PR's objectives and enhances script efficiency.
home/.chezmoiscripts/run_once_after_01-tmux-conf.sh.tmpl (1)
  • 10-10: Simplifying the conditional check for installing the tmux configuration by directly using the prompt function is a good practice. This change makes the script more concise and aligns with the PR's goal of enhancing user interaction.
home/.chezmoiscripts/run_once_before_01-install-homebrew.sh.tmpl (1)
  • 8-8: Directly invoking the prompt function for the conditional check to install Homebrew simplifies the script and improves the user experience. This change is consistent with the PR's objectives and enhances the setup process.
home/private_dot_config/private_fish/functions/__git.default_branch.fish (1)
  • 1-20: The overhaul of the __git.default_branch function to dynamically retrieve the default branch information from a remote repository is a significant improvement. This change removes reliance on hardcoded branch names and enhances the function's flexibility and reliability.
home/.chezmoiscripts/run_once_after_09-font-fira-code-setup.sh.tmpl (1)
  • 8-8: Simplifying the user prompt for installing Fira Code NerdFont by directly integrating it into the conditional check is a good practice. This change makes the script more concise and aligns with the PR's goal of enhancing user interaction.
home/.chezmoiscripts/run_once_after_11_eza-setup.sh.tmpl (1)
  • 8-8: The simplification of the conditional check using the prompt function directly is a good improvement for readability and maintainability. Ensure to test this script in different environments to confirm the prompt function behaves consistently.
home/.chezmoiscripts/run_once_after_10-gh-cli-setup.sh.tmpl (1)
  • 8-8: The direct use of the prompt function for conditional checks is a clean and maintainable approach. Please ensure to test this script across different environments to verify the prompt function's consistent behavior.
home/.chezmoiscripts/run_once_after_04-ssh-keys.sh.tmpl (2)
  • 8-8: The simplification of the conditional check using the prompt function directly is a good improvement for readability and maintainability. Ensure to test this script in different environments to confirm the prompt function behaves consistently.
  • 23-23: The direct use of the prompt function for conditional checks is a clean and maintainable approach. Please ensure to test this script across different environments to verify the prompt function's consistent behavior.
home/.chezmoitemplates/common (1)
  • 46-56: The modification to the prompt function to handle user input based on the .dev variable is a thoughtful approach to differentiate behavior in development environments. It's crucial to thoroughly test this change in various environments to ensure the intended behavior is achieved consistently.
home/.chezmoiscripts/run_once_after_06_1password-setup.sh.tmpl (1)
  • 8-8: The direct use of the prompt function for conditional checks is a clean and maintainable approach. Please ensure to test this script across different environments to verify the prompt function's consistent behavior.
home/.chezmoiscripts/run_once_after_00-passwordless-sudo.sh.tmpl (1)
  • 26-26: The simplification of the conditional check using the prompt function directly is a good improvement for readability and maintainability. Ensure to test this script in different environments to confirm the prompt function behaves consistently.
home/.chezmoiscripts/run_once_after_02-asdf-install.sh.tmpl (2)
  • 7-7: The simplification of the conditional check using the prompt function directly is a good improvement for readability and maintainability. Ensure to test this script in different environments to confirm the prompt function behaves consistently.
  • 35-35: The direct use of the prompt function for conditional checks is a clean and maintainable approach. Please ensure to test this script across different environments to verify the prompt function's consistent behavior.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 05cd2d2 and 5d96981.
Files selected for processing (15)
  • home/.chezmoi.toml.tmpl (2 hunks)
  • home/.chezmoiscripts/run_before_00-intro.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_00-passwordless-sudo.sh.tmpl (3 hunks)
  • home/.chezmoiscripts/run_once_after_01-tmux-conf.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_02-asdf-install.sh.tmpl (2 hunks)
  • home/.chezmoiscripts/run_once_after_03-docker-setup.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_04-ssh-keys.sh.tmpl (3 hunks)
  • home/.chezmoiscripts/run_once_after_06_1password-setup.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_07_vscode-setup.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_09-font-fira-code-setup.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_10-gh-cli-setup.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_after_11_eza-setup.sh.tmpl (1 hunks)
  • home/.chezmoiscripts/run_once_before_01-install-homebrew.sh.tmpl (1 hunks)
  • home/.chezmoitemplates/common (1 hunks)
  • home/private_dot_config/private_fish/functions/__git.default_branch.fish (1 hunks)
Files skipped from review as they are similar to previous changes (14)
  • home/.chezmoi.toml.tmpl
  • home/.chezmoiscripts/run_before_00-intro.sh.tmpl
  • home/.chezmoiscripts/run_once_after_00-passwordless-sudo.sh.tmpl
  • home/.chezmoiscripts/run_once_after_01-tmux-conf.sh.tmpl
  • home/.chezmoiscripts/run_once_after_02-asdf-install.sh.tmpl
  • home/.chezmoiscripts/run_once_after_03-docker-setup.sh.tmpl
  • home/.chezmoiscripts/run_once_after_04-ssh-keys.sh.tmpl
  • home/.chezmoiscripts/run_once_after_06_1password-setup.sh.tmpl
  • home/.chezmoiscripts/run_once_after_07_vscode-setup.sh.tmpl
  • home/.chezmoiscripts/run_once_after_09-font-fira-code-setup.sh.tmpl
  • home/.chezmoiscripts/run_once_after_10-gh-cli-setup.sh.tmpl
  • home/.chezmoiscripts/run_once_after_11_eza-setup.sh.tmpl
  • home/.chezmoiscripts/run_once_before_01-install-homebrew.sh.tmpl
  • home/.chezmoitemplates/common
Additional comments: 4
home/private_dot_config/private_fish/functions/__git.default_branch.fish (4)
  • 3-6: Consider adding a more detailed error message to help users troubleshoot when no remote is found. For instance, suggesting to check if the repository has been initialized or if remotes have been added.
  • 10-10: Executing git remote update with --prune option will update and prune the specified remote. While this is generally safe, it might be unexpected for some users. It's advisable to document this behavior or provide an option to skip pruning if not necessary for determining the default branch.
  • 13-17: The method used to extract the default branch name using grep and sed is effective but could be fragile if the output format of git remote show changes in future Git versions. Consider using a more robust method or tooling if available in the fish ecosystem to parse command outputs.
  • 14-16: The error message "Could not determine the default branch" is clear, but it might be helpful to include the name of the remote for which the default branch could not be determined. This could aid in debugging issues with specific remotes.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5d96981 and 14cb1b4.
Files selected for processing (1)
  • home/private_dot_config/private_fish/functions/__git.default_branch.fish (1 hunks)
Additional comments: 3
home/private_dot_config/private_fish/functions/__git.default_branch.fish (3)
  • 2-7: The approach to retrieve the global default branch name from Git configuration and defaulting to 'main' if not configured is well-implemented.
  • 9-16: Handling of remote name retrieval and the fallback for when no remote is found is well thought out, ensuring the function remains useful even in repositories without a remote.
  • 18-20: Fetching remote information with --prune to ensure up-to-date default branch information is a good practice.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 14cb1b4 and bd0ad7d.
Files selected for processing (1)
  • home/private_dot_config/private_fish/functions/__git.default_branch.fish (1 hunks)
Additional comments: 3
home/private_dot_config/private_fish/functions/__git.default_branch.fish (3)
  • 2-7: The approach to determine the global default branch name from Git configuration and defaulting to 'main' if not configured is robust and aligns with modern Git practices. Good job!
  • 9-16: Handling repositories without remotes by defaulting to the configured default branch or 'main' is a thoughtful approach. Using 'origin' as the default remote name aligns with common conventions. Well done!
  • 18-20: Fetching remote information with --prune to ensure the script operates with the most current information and maintains a clean local reference list is a good practice. Nicely done!

@mmena1 mmena1 merged commit 3d0d6fb into main Mar 22, 2024
1 check passed
@mmena1 mmena1 deleted the fix-setup branch March 22, 2024 20:01
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.

2 participants