Skip to content

Commit

Permalink
Merge pull request #27 from unnamed/docs/initial-docs
Browse files Browse the repository at this point in the history
Consistency & Documentation
  • Loading branch information
yusshu authored Mar 22, 2023
2 parents 5ddf120 + 7bd69d7 commit 8800d64
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 34 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Maven Package'

on: [ 'push', 'pull_request' ]

jobs:
build:
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B package --file pom.xml
25 changes: 25 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Getting Started

Welcome to the `command-flow` documentation

CommandFlow is a flexible command framework which removes lots of
boilerplate code used in commands

The command framework is divided into two parts. One is the actual
command framework and the other one is the API to allow creation of
a complete command tree based on annotations

### Components of the Command Framework

There are some basic components that you should at least be aware of to use **CommandFlow**
- **Command:** This is the most fundamental component, the **Command**. It contains all the information related to a command, included but not limited to name, aliases, permission, parts, etc.
Those are created using the `Command.builder(String)` method, which returns an `Command.Builder` instance where you can set all the information of the command.

- **CommandPart:** This is the second most fundamental component, it can be understood as every argument of a **Command**, including things like subcommands, flags, non positional arguments, etc. It can use arguments from the argument list, or provide them using any other means also they can forward the parsing to another part and just act as a modifier. Most of the default parts can be found at the class `Parts`

- **CommandContext**: This is a mutable object which contains the context for the called command including but not limited to the values for every part parsed, the raw arguments list and the raw arguments for every part, the labels and the Command execution path(which path of subcommands was taken).


### Known bugs or misbehaviours
The next list are the known bugs that must be resolved at some point:
- ~When using the FirstMatchPart in an ArgOrSub way(try to parse the arguments of the main command, if it fails try to parse the subcommand) with a main command with one argument(or more) and a subcommand that is optional, called with an unexistent subcommand, the main command will be called with no arguments, making it fail. The actual solution is to set the subcommand as required.~
2 changes: 2 additions & 0 deletions docs/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
getting-started.md
installation.md
31 changes: 31 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Installation

You can add `command-flow` to your project using [Gradle](https://gradle.org/),
[Maven](https://maven.apache.org/) or manually downloading the JAR files

### Gradle
```kotlin
repositories {
maven("https://repo.unnamed.team/repository/unnamed-public/")
}
```
```kotlin
dependencies {
implementation("me.fixeddev:commandflow-universal:0.5.3")
}
```

### Maven
```xml
<repository>
<id>unnamed-public</id>
<url>https://repo.unnamed.team/repository/unnamed-public/</url>
</repository>
```
```xml
<dependency>
<groupId>me.fixeddev</groupId>
<artifactId>commandflow-universal</artifactId>
<version>0.5.3</version>
</dependency>
```
41 changes: 7 additions & 34 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,9 @@
# CommandFlow
A flexible command framework which removes lots of boilerplate code used in commands.
# command-flow
[![Build Status](https://img.shields.io/github/actions/workflow/status/unnamed/command-flow/build.yml?branch=master)](https://github.com/unnamed/command-flow/actions/workflows/build.yml)
[![MIT License](https://img.shields.io/badge/license-MIT-blue)](license.txt)
[![Discord](https://img.shields.io/discord/683899335405994062)](https://discord.gg/xbba2fy)

## Usage
The command framework is divided into two parts. One is the actual command framework and the other one is the API to allow creation of a complete command tree based on annotations.
### Components of the Command Framework
A flexible command framework which removes lots of boilerplate code used in commands

There are some basic components that you should at least be aware of to use **CommandFlow**
- **Command:** This is the most fundamental component, the **Command**. It contains all the information related to a command, included but not limited to name, aliases, permission, parts, etc.
Those are created using the `Command.builder(String)` method, which returns an `Command.Builder` instance where you can set all the information of the command.

- **CommandPart:** This is the second most fundamental component, it can be understood as every argument of a **Command**, including things like subcommands, flags, non positional arguments, etc. It can use arguments from the argument list, or provide them using any other means also they can forward the parsing to another part and just act as a modifier. Most of the default parts can be found at the class `Parts`

- **CommandContext**: This is a mutable object which contains the context for the called command including but not limited to the values for every part parsed, the raw arguments list and the raw arguments for every part, the labels and the Command execution path(which path of subcommands was taken).

### Maven
#### Repository:
```xml
<repository>
<id>unnamed-public</id>
<url>https://repo.unnamed.team/repository/unnamed-public/</url>
</repository>
```

#### Dependency:
```xml
<dependency>
<groupId>me.fixeddev</groupId>
<artifactId>commandflow-universal</artifactId>
<version>0.5.3</version>
</dependency>
```

## Known bugs or misbehaviours
The next list are the known bugs that must be resolved at some point:
- ~When using the FirstMatchPart in an ArgOrSub way(try to parse the arguments of the main command, if it fails try to parse the subcommand) with a main command with one argument(or more) and a subcommand that is optional, called with an unexistent subcommand, the main command will be called with no arguments, making it fail. The actual solution is to set the subcommand as required.~
Check the [documentation](https://unnamed.team/docs/creative) for installation and
usage information for this project

0 comments on commit 8800d64

Please sign in to comment.