Skip to content

Set default shell to zsh and update active shell index#87

Merged
ericbsd merged 1 commit into
masterfrom
zsh
Mar 1, 2026
Merged

Set default shell to zsh and update active shell index#87
ericbsd merged 1 commit into
masterfrom
zsh

Conversation

@ericbsd
Copy link
Copy Markdown
Contributor

@ericbsd ericbsd commented Mar 1, 2026

Summary by Sourcery

Set the default shell selection to zsh in the admin creation UI and update the combo box to highlight zsh by default.

Enhancements:

  • Standardize the default shell to zsh regardless of system directory layout.
  • Adjust the shell combo box to default to the zsh option.

@ericbsd ericbsd requested review from a team as code owners March 1, 2026 19:03
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Mar 1, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Standardizes the default shell to zsh and updates the combo box to select the zsh entry by default in the user admin UI.

File-Level Changes

Change Details Files
Standardize default shell selection to zsh in the admin creation dialog.
  • Remove conditional logic that picked zsh or fish based on the presence of /Local/Users
  • Always set the default shell path variable to /usr/local/bin/zsh
  • Adjust the combo box active index so that the zsh option is selected by default
src/add_admin.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The hard-coded index shell.set_active(7) is brittle and will break if the list of shells changes; consider deriving the active index programmatically based on the selected shell string or keeping the shell options in a data structure you can search.
  • Instead of hard-coding /usr/local/bin/zsh, consider resolving the shell path dynamically (e.g., via /etc/shells, shutil.which, or configuration) to better handle differences across environments.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The hard-coded index `shell.set_active(7)` is brittle and will break if the list of shells changes; consider deriving the active index programmatically based on the selected shell string or keeping the shell options in a data structure you can search.
- Instead of hard-coding `/usr/local/bin/zsh`, consider resolving the shell path dynamically (e.g., via `/etc/shells`, `shutil.which`, or configuration) to better handle differences across environments.

## Individual Comments

### Comment 1
<location path="src/add_admin.py" line_range="131" />
<code_context>
         shell.append_text('ksh')
         shell.append_text('zsh')
-        shell.set_active(3)
+        shell.set_active(7)
         shell.connect("changed", self.on_shell)
         label = Gtk.Label(label='<b>Set Hostname</b>')
</code_context>
<issue_to_address>
**issue (bug_risk):** Using index 7 for `set_active` is out of range for the defined shell items and will likely result in no selection.

The combo box has 6 items (`sh`, `csh`, `bash`, `rbash`, `ksh`, `zsh`), so valid indices are 0–5. `shell.set_active(7)` won’t select anything. If you want `zsh` as the default, use index 5 or derive the index programmatically based on where `zsh` is added.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/add_admin.py
@ericbsd ericbsd merged commit 1fd30a2 into master Mar 1, 2026
3 checks passed
@ericbsd ericbsd deleted the zsh branch March 1, 2026 21:18
@github-project-automation github-project-automation Bot moved this from In Review to Done in Development Tracker Mar 1, 2026
@ericbsd ericbsd self-assigned this Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants