Skip to content

Commit

Permalink
docs: add guide pages
Browse files Browse the repository at this point in the history
  • Loading branch information
airscripts committed Oct 16, 2023
1 parent 5faf6c0 commit 8baf3c8
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 193 deletions.
11 changes: 8 additions & 3 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,23 @@ export default defineConfig({
src: LOGO,
},

editLink: {
pattern: 'https://github.com/airscripts/cacca/edit/main/docs/:path',
text: 'Suggest changes to this page',
},

nav: [
{ text: 'Home', link: '/' },
{ text: 'Documentation', link: '/docs' }
{ text: 'Documentation', link: '/getting-started' }
],

sidebar: [
{
text: 'Introduction',
text: 'Guide',
items: [
{ text: 'Getting Started', link: '/getting-started' },
{ text: 'Installation', link: '/installation' },
{ text: 'Scripting', link: '/scripting' }
{ text: 'Hello World', link: '/hello-world' }
]
}
],
Expand Down
1 change: 1 addition & 0 deletions docs/.vitepress/theme/styles.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
:root {
--vp-c-brand: #c8866a;
--vp-c-brand-1: #c8866a;
--vp-c-brand-2: #c8866a;
--vp-c-brand-light: #c8866a;
--vp-c-brand-lighter: #db9e82;
--vp-c-brand-lightest: #db9e82;
Expand Down
49 changes: 0 additions & 49 deletions docs/docs.md

This file was deleted.

52 changes: 5 additions & 47 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,7 @@
---
outline: deep
---
# Getting Started

# Runtime API Examples
## Overview
Cacca, italian word that means `shit`, is a workflow framework that aims to provide a faster development experience with the usage of a few interchangeable keywords and the power of Python.

This page demonstrates usage of some of the runtime APIs provided by VitePress.

The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:

```md
<script setup>
import { useData } from 'vitepress'

const { theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>
```

<script setup>
import { useData } from 'vitepress'

const { site, theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>

## More

Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
## Community
If you have questions or need help, reach out to the community at [GitHub Discussions](https://github.com/airscripts/cacca/discussions).
46 changes: 46 additions & 0 deletions docs/hello-toilet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Hello Toilet

## Overview
So you're telling me that you've survived the homepage, the getting started and also the installation?
You have to be my deepest fan nonetheless.
In this module we will write a simple Hello Toilet program with the use of Cacca.

## Scripting
For writing you Hello Toilet project in cacca, you'll need a few lines of code.
Cacca shines the most when you need to create huge workflows that can change from time to time.

Let's see the mock project that I've promised you:
```python
from cacca.lib import Cacca

cacca = Cacca()

cacca.insert({"action": print})
cacca.run(0, {"action": "Hello, Toilet!"})
```

Breaking this down, we import `Cacca` from its standard library and instantiate an object.
Yes you can have multiple objects and make free use of your creativity, creating multiple workflows at once.
```python
from cacca.lib import Cacca
cacca = Cacca()
```

After this, we have to just insert an action inside the pipeline.
`Actions` can be simple functions. For this project we're using print function directly from Python.
There is the possibility to add also `guards` and `hooks` that will be run respectively at the start and at the end of an action.
So if you're willing to make conditional workflows or enriched workflows, that's your best place to do that.
They have the same functionalities of an action, though.
```python
cacca.insert({"action": print})
```

When you've defined your pipeline, you can simply run it and give it, where needed, the arguments that it needs.
```python
cacca.run(0, {"action": "Hello, Toilet!"})
```

And that is all. That is **Cacca**.

## Community
If you have questions or need help, reach out to the community at [GitHub Discussions](https://github.com/airscripts/cacca/discussions).
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ hero:
actions:
- theme: brand
text: Documentation
link: /docs
link: /getting-started

- theme: alt
text: View On GitHub
Expand Down
59 changes: 15 additions & 44 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,20 @@
---
outline: deep
---
# Installation

# Runtime API Examples
## Overview
If you made this far, means that you love Cacca and I deeply appreciate that.
Without making more lovely sentences, let's start up our process for installing this browny framework.

This page demonstrates usage of some of the runtime APIs provided by VitePress.
## Requirements
In order to use Cacca, you will need the following:
- Python >= 3.11;
- A package manager for Python.

The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:

```md
<script setup>
import { useData } from 'vitepress'

const { theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>
## Install
Now that we have all the requirements at our hand, let's just install Cacca with this command:
```bash
$ pip install cacca
```
...and that's all. Yes it was *that* simple.

<script setup>
import { useData } from 'vitepress'

const { site, theme, page, frontmatter } = useData()
</script>

## Results

### Theme Data
<pre>{{ theme }}</pre>

### Page Data
<pre>{{ page }}</pre>

### Page Frontmatter
<pre>{{ frontmatter }}</pre>

## More

Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
## Community
If you have questions or need help, reach out to the community at [GitHub Discussions](https://github.com/airscripts/cacca/discussions).
49 changes: 0 additions & 49 deletions docs/scripting.md

This file was deleted.

0 comments on commit 8baf3c8

Please sign in to comment.