Skip to content

Commit

Permalink
master(feature): Add interactive mode for file selection
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelmansuy authored and CTY-git committed Sep 23, 2024
1 parent 6c9a7e9 commit 57383dd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ code2prompt --path /path/to/dir1 --path /path/to/file2.py [OPTIONS]
| `--create-templates` | | Create a templates directory with example templates |
| `--version` | `-v` | Show the version and exit |
| `--log-level` | | Set the logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL) |
| `--interactive` | `-i` | Activate interactive mode for file selection |

## Command Parameters

Expand Down Expand Up @@ -424,7 +425,7 @@ Result:
│ └── __pycache__
│ └── .pyc
├── __pycache__
│ └─ .pyc
│ └─ .pyc
├── templates
│ └── .j2
└── data
Expand Down Expand Up @@ -510,6 +511,35 @@ The code2prompt project now supports a powerful "include file" feature, enhancin

This approach allows you to organize your template structure more efficiently, improving maintainability and allowing for easy updates to specific sections without modifying the entire template. The include feature supports both relative and absolute paths, making it flexible for various project structures. By leveraging this feature, you can significantly reduce code duplication, improve template management, and create a more modular and scalable structure for your code2prompt templates.

## Interactive Mode

The interactive mode allows users to select files for processing in a user-friendly manner. This feature is particularly useful when dealing with large codebases or when you want to selectively include files without manually specifying each path.

### How to Use Interactive Mode

To activate interactive mode, use the `--interactive` or `-i` option when running the `code2prompt` command. Here's an example:

```bash
code2prompt --path /path/to/your/project --interactive
```

![](./docs/screen-example3.png)


### Features of Interactive Mode

- **File Selection**: Navigate through the directory structure and select files using keyboard controls.
- **Visual Feedback**: The interface provides visual cues to help you understand which files are selected or ignored.

### Keyboard Controls

- **Arrow Keys**: Navigate through the list of files.
- **Spacebar**: Toggle the selection of a file.
- **Enter**: Confirm your selection and proceed with the command.
- **Esc**: Exit the interactive mode without making any changes.

This mode enhances the usability of Code2Prompt, making it easier to manage file selections in complex projects.

## Configuration File

Code2Prompt supports a `.code2promptrc` configuration file in JSON format for setting default options. Place this file in your project or home directory.
Expand Down
Binary file added docs/screen-example3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 57383dd

Please sign in to comment.