Skip to content

feat: add _mnn#51

Open
michen00 wants to merge 5 commits intomainfrom
002-mnn-clipboard-en-em
Open

feat: add _mnn#51
michen00 wants to merge 5 commits intomainfrom
002-mnn-clipboard-en-em

Conversation

@michen00
Copy link
Copy Markdown
Owner

@michen00 michen00 commented Jan 31, 2026

Description

Have you ever Googled 'en dash' or 'em dash' just so you can copy and paste it somewhere? Say less. Push an en dash (U+2013) or an em dash (U+2014) onto your clipboard with single command:

  • em_ for an em dash: —
  • en_ for an en dash: –

Inspiration: https://github.com/rskottap/personal/blob/master/bin/emoji


notes to agents

  • em_ and en_ are symlinks
  • you can check CI logs to verify some assumptions
  • only suggest changes that are objectively better

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @michen00, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a convenient new feature that allows users to quickly copy typographic em dashes (—) and en dashes (–) to their system clipboard using simple shell commands, em_ and en_ respectively. The implementation is robust, featuring cross-platform compatibility for macOS, Linux (X11 and Wayland), and Windows, and includes thorough testing to ensure reliability across different environments and clipboard utilities.

Highlights

  • New Feature: Typographic Dash Commands: Introduced new em_ and en_ commands that allow users to quickly copy an em dash (—, U+2014) or an en dash (–, U+2013) to their system clipboard, respectively.
  • Cross-Platform Clipboard Support: The core script _mnn intelligently detects the operating system (macOS, Linux X11/Wayland, Windows) and uses the appropriate clipboard utility (pbcopy, xclip, xsel, wl-copy, clip.exe) to ensure broad compatibility.
  • Comprehensive Testing: A new BATS test suite (tests/_mnn.bats) has been added, covering script syntax, correct dash copying, clipboard content overwriting, platform-specific clipboard tool detection, help message display, and various error handling scenarios.
  • Documentation Update: The README.md file has been updated to include clear documentation for the new em_ and en_ commands, explaining their functionality and usage.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Repository owner deleted a comment from github-actions Bot Jan 31, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a useful utility for copying en and em dashes to the clipboard. The cross-platform support in the _mnn script is well-implemented. My main feedback concerns the implementation of the em_ and en_ wrapper scripts, which are currently fragile. The standard and most maintainable way to implement this pattern is to use symbolic links. I've provided an alternative suggestion to use robust wrapper scripts to avoid code duplication and improve maintainability. I've also included a few suggestions to simplify and improve the main _mnn script.

Comment thread em_
Comment thread _mnn
Comment thread _mnn
Comment thread _mnn Outdated
michen00 and others added 2 commits March 29, 2026 17:23
…restore prepare-readme CI path (#63)

* Initial plan

* fix: align README/script validation with symlink alias behavior

Agent-Logs-Url: https://github.com/michen00/bin/sessions/313fc3a4-290d-4437-b735-3f27637440bc

Co-authored-by: michen00 <29467952+michen00@users.noreply.github.com>

* test: harden prepare-readme failure case and clarify count diagnostics

Agent-Logs-Url: https://github.com/michen00/bin/sessions/313fc3a4-290d-4437-b735-3f27637440bc

Co-authored-by: michen00 <29467952+michen00@users.noreply.github.com>

* fix: correct count diagnostic and shellcheck suppression in validate-scripts

In validate_counts, the error message used $symlink_count (total
root-level symlinks) in the parenthetical breakdown of readme_count.
If any symlink is absent from the README, readme_script_count +
symlink_count > readme_count, making the sum incoherent.
Replace with readme_symlink_count = readme_count - readme_script_count
so the breakdown always sums correctly.

Also add SC2034 disable comment and null-op expansion for
cached_symlinks (used only via nameref, which shellcheck doesn't trace).
Align map declaration comments for readability.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: michen00 <29467952+michen00@users.noreply.github.com>

* fix: resolve pre-commit failures in validation and prepare-readme scripts

Agent-Logs-Url: https://github.com/michen00/bin/sessions/749605bb-5ced-4104-b081-41841295d752

Co-authored-by: michen00 <29467952+michen00@users.noreply.github.com>

* test: harden README mutation check in prepare-readme negative case

Co-authored-by: michen00 <29467952+michen00@users.noreply.github.com>

* fix: reject dangling symlink aliases in README validation

Agent-Logs-Url: https://github.com/michen00/bin/sessions/b5791642-cd05-49f0-994f-06a4a40a72ec

Co-authored-by: michen00 <29467952+michen00@users.noreply.github.com>

* test: simplify prepare-readme cleanup and clarify symlink-target exemption

Agent-Logs-Url: https://github.com/michen00/bin/sessions/b5791642-cd05-49f0-994f-06a4a40a72ec

Co-authored-by: michen00 <29467952+michen00@users.noreply.github.com>

* fix: pass pre-commit by removing dead helper and shellcheck cleanups

Agent-Logs-Url: https://github.com/michen00/bin/sessions/626be26f-6264-4da7-aced-1582b01ef11d

Co-authored-by: michen00 <29467952+michen00@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: michen00 <29467952+michen00@users.noreply.github.com>
…OS (#65)

* Initial plan

* test: harden prepare-readme validation checks

Agent-Logs-Url: https://github.com/michen00/bin/sessions/a74ca88c-5f0b-4f1c-955b-6fc6e153baac

Co-authored-by: michen00 <29467952+michen00@users.noreply.github.com>

* test: clarify prepare-readme README assertions

Agent-Logs-Url: https://github.com/michen00/bin/sessions/a74ca88c-5f0b-4f1c-955b-6fc6e153baac

Co-authored-by: michen00 <29467952+michen00@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: michen00 <29467952+michen00@users.noreply.github.com>
@michen00
Copy link
Copy Markdown
Owner Author

@copilot resolve the conflicts

# Conflicts:
#	scripts/test-prepare-readme.sh
#	tests/_mnn.bats

Co-authored-by: michen00 <29467952+michen00@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

@copilot resolve the conflicts

Conflicts resolved in c224f46. Merged origin/main into the branch — kept the bash re-exec logic and em_/en_ README checks from this PR, incorporated the setup_file() pasteboard-priming from main, and included the workflow's "Install bash (macOS only)" step.

@michen00 michen00 marked this pull request as ready for review March 30, 2026 06:16
Copilot AI review requested due to automatic review settings March 30, 2026 06:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the README preparation test script to account for the new em_ / en_ symlink commands (and ensure _mnn is not documented), and adds a Bash-version re-exec shim so the test can run with Bash ≥ 4.3 when available.

Changes:

  • Re-exec scripts/test-prepare-readme.sh under Bash ≥ 4.3 when the current Bash is older.
  • Add assertions that README.md documents em_ and en_ (symlinks) and does not document _mnn.
  • Update the step labeling from [1/2]...[2/2] to [1/3]...[3/3].

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/test-prepare-readme.sh
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Michael I Chen <michael.chen@aicadium.ai>
@michen00 michen00 requested a review from Copilot March 30, 2026 09:22
@michen00
Copy link
Copy Markdown
Owner Author

/gemini review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the test-prepare-readme.sh script to require Bash 4.3 or later, adding logic to search for a compatible interpreter in Homebrew paths if necessary. It also introduces a new validation step to check for specific symlink entries in the README.md file. Review feedback suggests refining the Homebrew path detection logic and aggregating multiple validation errors before exiting to improve usability.

Comment on lines +5 to +7
if command -v brew > /dev/null 2>&1; then
candidates=("$(brew --prefix bash 2> /dev/null)/bin/bash" "${candidates[@]}")
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The current logic for finding the Homebrew-installed bash can be improved. If brew --prefix bash fails (e.g., bash is not installed via Homebrew), the command substitution $(...) will be empty, causing /bin/bash to be added as a candidate. This is likely the system's default (and old) bash, which will then be checked unnecessarily. A more robust approach is to check the exit status and output of brew --prefix bash and only add the candidate path if it succeeds and provides a path.

Suggested change
if command -v brew > /dev/null 2>&1; then
candidates=("$(brew --prefix bash 2> /dev/null)/bin/bash" "${candidates[@]}")
fi
if command -v brew >/dev/null 2>&1 && brew_prefix="$(brew --prefix bash 2>/dev/null)" && [[ -n "$brew_prefix" ]]; then
candidates=("$brew_prefix/bin/bash" "${candidates[@]}")
fi

Comment on lines +26 to +37
if ! grep -qF -- "- [\`em_\`](em_):" README.md; then
echo "README is missing the em_ symlink entry" >&2
exit 1
fi
if ! grep -qF -- "- [\`en_\`](en_):" README.md; then
echo "README is missing the en_ symlink entry" >&2
exit 1
fi
if grep -qF -- "- [\`_mnn\`](_mnn):" README.md; then
echo "README should document em_ and en_ symlinks, not _mnn" >&2
exit 1
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

These checks for README.md content are good, but they exit on the first failure. This means if multiple things are wrong, the user has to run the test multiple times to fix them all. It would be more user-friendly to collect all errors and report them at once.

Suggested change
if ! grep -qF -- "- [\`em_\`](em_):" README.md; then
echo "README is missing the em_ symlink entry" >&2
exit 1
fi
if ! grep -qF -- "- [\`en_\`](en_):" README.md; then
echo "README is missing the en_ symlink entry" >&2
exit 1
fi
if grep -qF -- "- [\`_mnn\`](_mnn):" README.md; then
echo "README should document em_ and en_ symlinks, not _mnn" >&2
exit 1
fi
errors=()
if ! grep -qF -- "- [\`em_\`](em_):" README.md; then
errors+=("README is missing the em_ symlink entry")
fi
if ! grep -qF -- "- [\`en_\`](en_):" README.md; then
errors+=("README is missing the en_ symlink entry")
fi
if grep -qF -- "- [\`_mnn\`](_mnn):" README.md; then
errors+=("README should document em_ and en_ symlinks, not _mnn")
fi
if ((${#errors[@]} > 0)); then
printf "%s\n" "${errors[@]}" >&2
exit 1
fi

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.

3 participants