Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trashhalo/astro-command
run commands as astro components
https://github.com/trashhalo/astro-command
astro pin
Last synced: 3 months ago
JSON representation
run commands as astro components
- Host: GitHub
- URL: https://github.com/trashhalo/astro-command
- Owner: trashhalo
- License: mit
- Created: 2021-09-18T15:03:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-19T20:14:12.000Z (over 3 years ago)
- Last Synced: 2024-10-24T13:44:33.775Z (3 months ago)
- Topics: astro, pin
- Language: Astro
- Homepage:
- Size: 14.9 MB
- Stars: 29
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Astro Command
Astro component for static rendering of commands. This allows you build components in any language.
[Demo](https://github.com/trashhalo/astro-command/blob/main/src/components/Demo.astro)
## Usage
```astro
---
import { Command } from "astro-command";
---```
Component.py
```python
#!/usr/bin/env pythonimport sys, json
data = json.load(sys.stdin)
print(f'Hello {data["message"]}
')
```* caller: url of the caller so we can use it to look up relative paths
* command: name of the command to execute. relative path from the caller
* props: all props are passed to command as json via stdin
* html: generated html sent out via stdout embedded