Skip to content

Conversation

@andriy-git
Copy link

I know this is a full revamp. It might not even be going in the direction that you wanted, but I rather you have it than me just keeping it.

It is now more than just Regular Expressions. It is also json and awk training ground.

…tructure project

- Migrate from Poetry configuration to standard pyproject.toml format

- Update dependencies structure and build system to use setuptools

- Change script entry point from rexi.cli to rexi.main

- Remove Poetry-specific files (poetry.lock, poetry.toml, Makefile)

- Add temp* and run.sh to .gitignore

- Update README with source installation instructions

- Complete file reorganization: cli.py renamed to parser.py, regex_help.py moved to utils/
- Update test_logic.py to use unittest instead of pytest

- Update test_cli.py to use unittest and adjust for new module structure

- Update test_ui.py to use unittest and adjust for new module structure

- Remove pytest dependencies from test files
- Create install.sh script that sets up venv and installs dependencies

- Script creates run.sh with full path and symlinks to ~/.local/bin

- The rexi command becomes available system-wide after installation
- Use readlink -f to resolve symlinks and get actual script location

- This ensures .venv is found relative to project directory, not symlink location
- Create run_tests.sh script to run tests using the project's virtual environment

- Script activates venv and runs unittest with proper error handling

- Supports running all tests or specific test modules/classes
- Added pyperclip>=1.8.2 as a project dependency
- Enables copy pattern to clipboard functionality
- Added 'jq' profile type to support JSON processing with JQ
- Profile includes name, description, and type configuration
- Sets up foundation for JQ mode functionality
- Added #output-container.full-width style that sets width to 100%
- Removes the right border when in full-width mode
- Enables the ability to hide the side panel and expand output area
**JQ Mode Support:**
- Added JQ mode state variables (is_jq_mode, jq_executor)
- Implemented _switch_to_jq_mode method to handle UI switching
- Added JQ-specific help content with get_jq_help_content
- Added update_jq method to execute JQ programs
- Added UI updates when switching to JQ mode

**UI Enhancements:**
- Enhanced toggle_view action to support 4 view modes (Groups/Help/Features/Hidden)
- Added full-width output functionality when side panel is hidden
- Added 'Copy Pattern' button with clipboard functionality
- Updated UI state management for different modes

**Code Infrastructure:**
- Added pyperclip import with error handling
- Integrated JQ execution in the input processing flow
- Enhanced profile switching to support JQ profiles
- Changed expected profile name from 'PCRE (Full)' to 'RE - PCRE (Full)'
- Aligns test with updated profile name in profiles.json
- Implemented JqExecutor class to run JQ programs via subprocess
- Includes availability checking using shutil.which
- Added error handling for various execution scenarios
- Supports timeout configuration and proper error reporting
- Created TestCopyButton class to test clipboard functionality
- Added tests for successful copy, empty pattern, missing pyperclip, and error cases
- Uses mocking to test clipboard operations without actual clipboard access
- Created TestJqExecutor class to test JQ execution functionality
- Added tests for availability checking, identity filter, and various filters
- Includes tests for error cases like invalid JSON and filters
- Uses proper skip logic when JQ is not installed on the system
- Created TestHideSidePanel class to test panel hiding functionality
- Added tests for view mode cycling in both regex and awk modes
- Tests the full-width output container class manipulation
- Verifies proper UI state management when switching between modes
- Add JQ filter support to the list of features
- Document system dependencies for AWK and JQ
- Update controls section with new copy pattern shortcut (Ctrl+Shift+C)
- Add JQ examples to usage section
- Update profile list to include JQ option
- Add Ctrl+C keyboard shortcut for copying patterns to clipboard
- Update copy pattern button text to show keyboard shortcut
- Update import organization for clarity
- Clean up duplicate decorator in input change handler
- Update docstring to reflect new hidden view mode in toggle functionality
- Update selectors to use groups-container for better test stability
- Add test coverage for new hidden view mode (mode 3)
- Ensure proper cycling through all view modes including hidden state
@royreznik
Copy link
Owner

Hi! Thats seems like a huge change, and i will need to free some times to review it

I will guess part / most of it is AI generated?

Any way i think in the next few weeks i will do a deep dive into it, it seems like a very nice change, although im not sure it is the main purpose of rexi

I will take a look later :)

@andriy-git
Copy link
Author

Yes. You can pull my clone and check it out. I know Rexi was just for regex. It is doing different regex that people come across from the full Perl to regex in grep. It uses AWK as the programming language, not just its regex. That is why it is an external dependency. JQ is also an external dependency. Both update the results. It's a really good training ground for the really important tools and regex.

I wasn't even going to do a pull request with it. For example, I personally try to use minimum dependencies in my projects. So I removed pytests for just unittests and version bump. Also, you had a few dead dependencies that I removed. There are other things I did that are specific to my workflow that you may think are unnecessary. The thing is that it turned out so nicely, I kind of said to myself, "Why not?"

I also understand that it is way beyond the original extent of Rexi. It will not hurt my feelings if you close the pull request. I just didn't want to keep it to myself.

2025-12-07_09-52

@cargilcm
Copy link

cargilcm commented Dec 12, 2025

Hi! Thats seems like a huge change, and i will need to free some times to review it

I will guess part / most of it is AI generated?

Any way i think in the next few weeks i will do a deep dive into it, it seems like a very nice change, although im not sure it is the main purpose of rexi

I will take a look later :)

This is the first discussion of such a nature I've seen on Github so far. I'm interested in the discussion aspect and the roadmaps (I'm tracking code closely) for this main branch of rexi and the pull request #36 branch.

A further bit, I think I'm on the cusp of deciding how much influence to allow AI to have on my programming contributions yet have utilized it for some small LOC programs and some up to say 100 lines of code for TUI's, especially related to ncurses but realized lately the superior user friendliness of textual and other higher level abstractions (I recommend micro editor written in go). And I'm quite interested in helping a/several mainstream regex-oriented TUI program(s) evolve.

I of course yield any opinions on these projects to you guys but I may up and run with my own fork with your permission to integrate yet more (or more aptly read different) features - I feel like there are two tracks the project could go in for a regex TUI: honing in on what rexi does with regex mainly (by which I even think maybe #36 exceeds rexi in the field for visualizing groups) or branching out and letting all the suggestions for improvement that AI runs with to unfurl.

Fwiw, my vision straddles the current code for these two projects in the middle: I'd just like the additional ability beyond regex matching to accommodate replace and list.. And I'll come back to edit my comment later to illustrate what I mean by "list"

Thank you both for these great terminal -based regex TUIs,
Chris

@royreznik
Copy link
Owner

@andriy-git @cargilcm Got you guys

I will take a deeper look later this weekend, can you please fix the CI meanwhile?

@cargilcm
Copy link

cargilcm commented Dec 17, 2025

While I presume

can you please fix the CI meanwhile?

is intended for andriy-git, I'm afraid I'm very green when it comes to these CI changes. I tried to look into the failed tests to jump the gun but only when I ran andriy-git's ./run_tests.sh with/without venv did I figure out how the tests work at all. Commenting out the line for venv activate, all the unit tests seemed to run and succeed for me but that doesn't accommodate a make install. I did find the yaml

@andriy-git , do you want to make a pass at getting the CI to pass?

I'd like to say if it ain't broke don't fix it, but @royreznik seems to want to rely on the unit tests which he no doubt painstakingly crafted by hand and his own build commands if I understand. Personally, I would favor a final version that accommodates running the tests as simply as the andriy-git's branch script and doesn't require poetry but I can go silent till I hear y'all deciding how to address the ci and dependencies issues. My rationale for looking a simpler build without poetry is I wasn't free to implement changes that I could then commit back, otherwise. My development environment is merely a 2024 Motorola Android phone.

In the meantime thanks again to you both
Cheers
Chris

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