Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soliez/pylight
Command line utility for viewing code snippets and source code files with syntax-highlighting
https://github.com/soliez/pylight
Last synced: about 2 months ago
JSON representation
Command line utility for viewing code snippets and source code files with syntax-highlighting
- Host: GitHub
- URL: https://github.com/soliez/pylight
- Owner: Soliez
- Created: 2024-02-17T05:47:31.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-07-20T15:20:22.000Z (6 months ago)
- Last Synced: 2024-07-21T04:23:11.968Z (6 months ago)
- Language: Python
- Homepage:
- Size: 25.8 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pylight
Command line utility for viewing code snippets and source code files with syntax-highlighting## Installation
> Before you get started, ensure you have Python 3.8 or later installed#### **Step 1:** Clone this repository
```bash
git clone https://github.com/Soliez/pylight.git
```#### **Step 2:** Run the install script
```bash
python3 pylight/install.py
```### Alternative Installations
Pylight is also available as a compiled binary. See the [Releases](https://github.com/Soliez/pylight/releases) page for more details.
---
## Usage
> All of the following example usages are valid
### Reading input from a file
Invoking pylight with the `-f` flag instructs pylight to treat the second argument as a file path
```bash
pylight -f
```---
### Reading input from a command line argument
Invoking pylight with the `-c` flag instructs pylight to treat the second argument as code
```bash
pylight -c "import requests; r = requests.get('https://jsonplaceholder.typicode.com/users'); print(r.json())"
```---
### Reading input from an interactive prompt
Invoking pylight with the `-i` flag instructs pylight to read the input from the user with an interactive prompt at runtime
```bash
pylight -i
```
---### Reading input from standard-in
Invoking pylight with the `-` flag instructs pylight to read the input from `stdin`
```bash
echo "import requests; r = requests.get('https://jsonplaceholder.typicode.com/users'); print(r.json())" | pylight -
```
---### Example Output
```bash
$ pylight -f example.py
```
```python3
import requestsr = requests.get("https://jsonplaceholder.typicode.com/users")
print(r.json())
```