pieces-app / cli-agent

Pieces CLI for interacting with Pieces OS
https://docs.pieces.app/extensions-plugins/cli
MIT License
56 stars 22 forks source link

Add terminal code highlighting and editor opening functionality #150 #152

Closed sambhavnoobcoder closed 3 months ago

sambhavnoobcoder commented 3 months ago

Add terminal code highlighting and editor opening functionality

Description

This PR enhances the open_asset command by adding syntax highlighting when displaying code snippets in the terminal and introducing the ability to open assets in the user's preferred editor.

Changes

  1. Added terminal code highlighting using Pygments library.
  2. Implemented a new -e flag for the open_asset command to open assets in an external editor.
  3. Created a new config command to set and manage user preferences, including the preferred editor.
  4. Modified the open_asset method to support these new features.

Implementation Details

Terminal Code Highlighting

Editor Opening Functionality

Testing

you can use the following code for testing the terminal code highlighting : ListCommand.list_command(type="assets")

meanwhile , for the code editor , change the code editor config via : AssetsCommands.config(editor = "code")

and call the code editor to open using : AssetsCommands.open_asset(item_index=1, open_in_editor=True)

you can use the -e flag in the terminal while calling it via the terminal as well .

Bishoy-at-pieces commented 3 months ago

Forgot to mention adding these changes to the CHANGELOG

Bishoy-at-pieces commented 3 months ago

Yes Mark I included that in other issue