Skip to content

Commit

Permalink
Merge pull request #9 from MarkusSagen/feat-only-apply-fixes-from-rej…
Browse files Browse the repository at this point in the history
…x-files

Feat only apply fixes from rejx files
  • Loading branch information
MarkusSagen authored Oct 12, 2024
2 parents f089c5a + 238678b commit 933b62b
Show file tree
Hide file tree
Showing 5 changed files with 342 additions and 111 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,32 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.1.0](https://github.com/MarkusSagen/rejx/pull/7) - 2024-10-12
## [0.1.0](https://github.com/MarkusSagen/rejx/pull/9) - 2024-10-12

New release, fixes bugs and adds new options for selection

### Added

- New `tree` command as an alias for `ls --view tree`
- Two new flags for targeting hidden files with `rejx`:
- `--include-hidden` to include hidden files when searching
- `--exclude-hidden` to exclude hidden files when searching
- New flag, `--all`, to the fix and clean commands by @StephanLoor

### Changed

- Refactored `find_rej_files` function to accept a path parameter
- Updated `fix`, `diff`, `ls`, and `clean` commands to use a consistent interface
- Enhanced README with more detailed usage examples
- Consistent `path` argument across all commands
- Improved error handling and user feedback
- The `--all` flag now works with a specified directory path

### Fixed

- Bug in previous release, making it not possible to install (See #2)
- Make consistent behaviour for the commands in rejx
- Improved handling of non `.rej` files in various commands
- Better error messages when invalid paths are provided
- Remove logs incorrectly suggesting that changes could be applied from non-rejx files
- Bug with duplicate logging when setting up rich logger
76 changes: 55 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ It's important to use the commands cautiously, especially fix_all and clean, as

This documentation provides a clear guide on how to interact with the rejx Typer application, making it easier for users to understand and utilize its functionalities.

## Setup
<img width="825" alt="Screenshot 2024-10-12 at 10 08 31" src="https://github.com/user-attachments/assets/25ff2011-74f4-494a-9199-b3fac219185b">

## Installation

```shell
# Pip
Expand All @@ -26,47 +28,60 @@ poetry add rejx

Your Python Typer application, rejx, provides a command line interface (CLI) for managing .rej files, which are typically generated when patches fail to apply cleanly. Below, I'll detail each command, its purpose, and how to use it, including optional arguments.

Most rejx commands support the flags:

- `--all` - Recursively apply the command in subfolders
- `--preview` - Preview what a command would do before applying
- `--show-hidden` - Include hidden files (`.file`) when applying the command
- `--exclude-hidden` - Exclude hidden files from command

For more details, rejx provides help for each commands

```sh
rejx --help
rejx <command> --help
```

### `fix`

Purpose: Applies the changes from one or more specified .rej file to their corresponding original file.
Usage:
Applies the changes from one or more specified `.rej` file to their corresponding original file.

`rejx fix path/to/file1.rej path/to/file2.rej ...`

Passing the optional flag `--all` applies the changes from all .rej files to their corresponding original files. Usage:
Passing the optional flag `--all` applies the changes from all .rej files to their corresponding original files.

`rejx fix --all`

### `diff`

Purpose: Displays the differences between the current file(s) and the changes proposed in the corresponding .rej file(s).
Usage:
Displays the differences between the current file(s) and the changes proposed in the corresponding .rej file(s).

`rejx diff <filename1> <filename2> ...`

If no file name is passed, this displays the difference for all .rej files.

Note: This command uses a pager for output. Use arrow keys or Vim bindings to navigate, and q to quit.
[!NOTE] This command uses a pager for output. Use arrow keys or Vim bindings to navigate, and q to quit.

### `ls`

Purpose: Lists all .rej files in the current directory and subdirectories. By default, it lists files, but can also display them in a tree structure.
Usage:
Lists all .rej files in the current directory and subdirectories. By default, it lists files, but can also display them in a tree structure.
For listing files:

`rejx ls`

For tree view:
`rejx ls .`

`rejx ls --view tree`
The ls command supports different view modes.
Default view is a list of files, but there's also a tree view mode

For list view (default):
For tree view:

`rejx ls --view list`
`rejx ls . --view tree`
`rejx tree .`

### `clean`

Purpose: Deletes specified .rej files. It has an optional preview feature.
Usage:
Deletes specified .rej files. It has an optional preview feature.
The preview flag makes it possible to _preview_ which files would be staged for deletion before
applying it.

`rejx clean path/to/file1.rej path/to/file2.rej ...`

Expand All @@ -75,11 +90,30 @@ With preview:
`rejx clean path/to/file1.rej path/to/file2.rej ... --preview`

By passing the optional `--all` flag, this command deletes all the .rej files in the current directory and subdirectories.
Usage:
`rejx clean --all`

`rejx clean . --all`

This can be combined with the `--preview` option.
Usage:
`rejx clean --all --preview`

`rejx clean . --all --preview`

## Shell Completion

To install shell completion for rejx commands

```sh
rejx --install-completion && exec $SHELL
```

______________________________________________________________________

## Dev

For developers looking to apply changes or contribute changes, install the project with the just
command

This will install the project, pre-commit and the dev dependencies

```sh
just setup
```
Loading

0 comments on commit 933b62b

Please sign in to comment.