Skip to content

Commit

Permalink
docs: update name references to centurion
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxuum committed Jul 7, 2024
1 parent e8eafe1 commit 6557c30
Show file tree
Hide file tree
Showing 17 changed files with 76 additions and 71 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<a href="https://commander.paradoxum.dev/" target="_blank">
<a href="https://centurion.paradoxum.dev/" target="_blank">
<img src="docs/src/assets/logo.webp" width="150" />
</a>

Expand All @@ -17,10 +17,10 @@
[npm-latest-url]: https://www.npmjs.com/package/@rbxts/commander/v/latest
[npm-next-badge]: https://img.shields.io/npm/v/%40rbxts%2Fcommander%2Fnext?logo=npm&label=next
[npm-next-url]: https://www.npmjs.com/package/@rbxts/commander/v/next
[ci-badge]: https://github.com/paradoxuum/commander/actions/workflows/ci.yml/badge.svg?branch=main
[ci-url]: https://github.com/paradoxuum/commander/actions/workflows/ci.yml
[ci-badge]: https://github.com/paradoxuum/centurion/actions/workflows/ci.yml/badge.svg?branch=main
[ci-url]: https://github.com/paradoxuum/centurion/actions/workflows/ci.yml

<a href="https://commander.paradoxum.dev/">📖 Documentation</a>
<a href="https://centurion.paradoxum.dev/">📖 Documentation</a>
</div>


Expand Down
6 changes: 3 additions & 3 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import starlightLinksValidator from "starlight-links-validator";

// https://astro.build/config
export default defineConfig({
site: "https://commander.paradoxum.dev",
site: "https://centurion.paradoxum.dev",
integrations: [
starlight({
title: "Commander",
title: "Centurion",
description: "Flexible command framework for roblox-ts",
social: {
github: "https://github.com/paradoxuum/commander",
github: "https://github.com/paradoxuum/centurion",
discord: "https://discord.roblox-ts.com/",
},
logo: {
Expand Down
10 changes: 5 additions & 5 deletions docs/src/content/docs/_fragments/install.mdx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { Tabs, TabItem } from '@astrojs/starlight/components';
import { TabItem, Tabs } from '@astrojs/starlight/components';

<Tabs>
<TabItem label="npm">
```sh frame=none
npm install @rbxts/commander
npm install @rbxts/centurion
```
</TabItem>
<TabItem label="yarn">
```sh frame=none
yarn add @rbxts/commander
yarn add @rbxts/centurion
```
</TabItem>
<TabItem label="pnpm">
```sh frame=none
pnpm add @rbxts/commander
pnpm add @rbxts/centurion
```
</TabItem>
<TabItem label="bun">
```sh frame=none
bun add @rbxts/commander
bun add @rbxts/centurion
```
</TabItem>
</Tabs>
10 changes: 5 additions & 5 deletions docs/src/content/docs/guides/commands/defining-commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ To avoid confusing bugs or errors, make sure to look at

Commands are defined using [decorators](https://www.typescriptlang.org/docs/handbook/decorators.html).

Commander has four decorators:
Centurion has four decorators:

- `@Commander` - Classes containing commands must be decorated with this to be registered
- `@Centurion` - Classes containing commands must be decorated with this to be registered
- `@Command` - Used to define commands
- `@Group` - Used to assign groups to a command
- `@Guard` - Used to assign guards to a command

A command can be defined like so:

<Code lang="ts" code={`
@Commander
@Centurion
class EchoCommand {
@Command({
name: "echo",
Expand All @@ -31,7 +31,7 @@ class EchoCommand {
{
name: "text",
description: "The text to display",
type: CommanderType.String,
type: CenturionType.String,
},
],
})
Expand Down Expand Up @@ -92,7 +92,7 @@ parameter types don't match!
{
name: "text",
description: "The text to display",
type: CommanderType.String, // We're requesting a string for this argument...
type: CenturionType.String, // We're requesting a string for this argument...
},
],
})
Expand Down
10 changes: 5 additions & 5 deletions docs/src/content/docs/guides/commands/groups.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You can assign groups in two ways:
For example, let's say you want to organize view and delete commands under a profile group:

<Code lang="ts" code={`
@Commander
@Centurion
// Assigning a group at the class level assigns the group to all
// commands in the class.
// You can also do this at the method level, but it's recommended to do it this
Expand All @@ -31,7 +31,7 @@ class ProfileCommand {
{
name: "player",
description: "The player",
type: CommanderType.Player,
type: CenturionType.Player,
},
],
})
Expand All @@ -44,7 +44,7 @@ class ProfileCommand {
{
name: "player",
description: "The player",
type: CommanderType.Player,
type: CenturionType.Player,
},
],
})
Expand All @@ -60,13 +60,13 @@ cannot have child groups. This limitation means the maximum nesting level is 2,
To define a group as a child of another group, you specify its name using the root key:

<Code lang="ts" code={`
@Commander
@Centurion
@Group("info")
class InfoCommand {
@Command({
name: "view",
description: "View information about a player",
arguments: [{ name: "player", description: "Player to view information for", type: CommanderType.Player }],
arguments: [{ name: "player", description: "Player to view information for", type: CenturionType.Player }],
})
// If info was a global group, you could do @Group("user") here
@Group("user")
Expand Down
6 changes: 3 additions & 3 deletions docs/src/content/docs/guides/commands/guards.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Guards can be assigned in three ways:
- At the class-level, which assigns the guard to all commands in the class.
Guards assigned at the class-level will be executed before method-level guards.
- At the method-level, which assigns the guard to a single command.
- Through the `guards` option when starting Commander, which assigns the guard
- Through the `guards` option when starting Centurion, which assigns the guard
to all commands.

A guard function is passed the same `CommandContext` that will be passed to the command.
Expand All @@ -36,7 +36,7 @@ const isAdmin: CommandGuard = (ctx) => {
return true;
};
@Commander
@Centurion
class KickCommand {
@Command({
name: "kick",
Expand All @@ -45,7 +45,7 @@ class KickCommand {
{
name: "player",
description: "Player to kick",
type: CommanderType.Player
type: CenturionType.Player
}
]
})
Expand Down
10 changes: 5 additions & 5 deletions docs/src/content/docs/guides/commands/shortcuts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ They can be configured with one or more key combinations.
## Configuration

Shortcuts can be enabled or disabled by configuring the `shortcutsEnabled` option when starting
`CommanderClient`.
`CenturionClient`.

Shortcuts are **enabled** by default.

<Code lang="ts" code={`
CommanderClient.start((registry) => {}, {
CenturionClient.start((registry) => {}, {
shortcutsEnabled: false,
});`
} />
Expand All @@ -27,7 +27,7 @@ the `showShortcutSuggestions` option.
Shortcut suggestions are **enabled** by default.

<Code lang="ts" code={`
CommanderInterface.create({
CenturionUI.create({
showShortcutSuggestions: false,
});
`} />
Expand All @@ -42,7 +42,7 @@ In the following example, the command is configured to execute when the user
presses `E` or `LeftAlt + E`.

<Code lang="ts" code={`
@Commander
@Centurion
export class EchoCommand {
@Command({
name: "echo",
Expand All @@ -63,7 +63,7 @@ to the command, printing `Hello, world!`.
If the user presses `E`, no arguments will be provided and `Echo!` will be printed.

<Code lang="ts" code={`
@Commander
@Centurion
export class EchoCommand {
@Command({
name: "echo",
Expand Down
14 changes: 7 additions & 7 deletions docs/src/content/docs/guides/examples.mdx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
title: Examples
description: Learn the basic usage of Commander through examples
description: Learn the basic usage of Centurion through examples
---

import { Code, TabItem, Tabs } from '@astrojs/starlight/components';

## Kick Command

<Code lang="ts" code={`
import { Command, CommandGuard, CommandContext, Commander, CommanderType, Guard } from "@rbxts/commander";
import { Command, CommandGuard, CommandContext, Centurion, CenturionType, Guard } from "@rbxts/centurion";
const isAdmin: CommandGuard = (ctx) => {
if (ctx.executor.UserId !== 1) {
Expand All @@ -19,7 +19,7 @@ const isAdmin: CommandGuard = (ctx) => {
return true;
};
@Commander
@Centurion
class KickCommand {
@Command({
name: "kick",
Expand All @@ -28,7 +28,7 @@ class KickCommand {
{
name: "player",
description: "Player to kick",
type: CommanderType.Player
type: CenturionType.Player
}
]
})
Expand All @@ -54,7 +54,7 @@ const isAdmin: CommandGuard = (ctx) => {
return true;
};
@Commander
@Centurion
// Assigning a group to the class will
// make all commands in the class belong to that group
@Group("info")
Expand All @@ -70,7 +70,7 @@ class InfoCommand {
{
name: "player",
description: "Player to display information about",
type: CommanderType.Player,
type: CenturionType.Player,
},
],
})
Expand All @@ -95,7 +95,7 @@ class InfoCommand {
</TabItem>
<TabItem label="main.client.ts">
<Code lang="ts" code={`
CommanderServer.start((registry) => {
CenturionServer.start((registry) => {
registry.registerGroup(
{
name: "info",
Expand Down
29 changes: 17 additions & 12 deletions docs/src/content/docs/guides/index.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Getting Started
description: Learn how to install, start and register commands with Commander
description: Learn how to install, start and register commands with Centurion
sidebar:
order: 0
---
Expand All @@ -11,31 +11,34 @@ import Install from '@fragments/install.mdx';
export const clientCode = `
`;

Commander is a flexible and extensible command framework for roblox-ts that
Centurion is a flexible and extensible command framework for roblox-ts that
makes defining commands easy and readable.

<Card title="Installation" icon="rocket">
<Install />
</Card>

## Starting Commander
## Starting Centurion

Commander needs to be started **once** on the client and server.
Centurion needs to be started **once** on the client and server.

<Tabs>
<TabItem label="Client">
<Aside type="caution" title="Usage with React">
When using React in development mode (`_G.__DEV__` set to true),
you must set `_G.__DEV__` to true **before importing** Commander.
you must set `_G.__DEV__` to true **before importing** Centurion.
</Aside>

<Code lang="ts" code={`
CommanderClient.start(
import { CenturionClient } from "@rbxts/centurion";
import { CenturionUI } from "@rbxts/centurion-ui";
CenturionClient.start(
(registry) => {
// Register commands or types here
},
{
interface: CommanderInterface({
interface: CenturionUI.create({
// You can configure the interface here, such as changing activation keys
}),
Expand All @@ -48,13 +51,15 @@ CommanderClient.start(
// This is set to true by default
registerBuiltInTypes: true,
},
).catch((err) => warn("Commander could not be started:", tostring(err)));
).catch((err) => warn("Centurion could not be started:", tostring(err)));
`} />
</TabItem>

<TabItem label="Server">
<Code lang="ts" code={`
CommanderServer.start(
import { CenturionServer } from "@rbxts/centurion";
CenturionServer.start(
(registry) => {
// Register commands or types here
},
Expand All @@ -63,7 +68,7 @@ CommanderServer.start(
// This is set to true by default.
registerBuiltInTypes: true,
},
).catch((err) => warn("Commander could not be started:", tostring(err)));
).catch((err) => warn("Centurion could not be started:", tostring(err)));
`} />
</TabItem>
</Tabs>
Expand All @@ -78,7 +83,7 @@ Command modules should be loaded from within the start callback to avoid registr
The way commands and types are registered is the same on the server and client.

<Code lang="ts" code={`
CommanderServer.start((registry) => {
CenturionServer.start((registry) => {
// Load all child ModuleScripts under the given Instance
const commandContainer = script.Parent.commands;
registry.load(commandContainer);
Expand Down Expand Up @@ -107,5 +112,5 @@ CommanderServer.start((registry) => {
// To register the loaded commands and types, you then
// call the register method:
registry.register();
}).catch((err) => warn("Commander could not be started:", tostring(err)));
}).catch((err) => warn("Centurion could not be started:", tostring(err)));
`} />
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ which will require all child ModuleScripts in the container, or a similar method
such as `addPaths`,
provided by [Flamework](https://flamework.fireboltofdeath.dev/).

For commands to be registered, the parent class must be decorated with [@Commander](/reference/decorators#commander).
For commands to be registered, the parent class must be decorated with [@Centurion](/reference/decorators#centurion).
For types, they are marked for registration automatically in the
`TypeBuilder.build()` method.

<Code lang="ts" code={`
const types = ReplicatedStorage.types;
CommanderServer.start((registry) => {
CenturionServer.start((registry) => {
// Load command/type modules
registry.load(script.Parent.commands);
registry.load(types);
// Register commands and types
registry.register();
}).catch((err) => warn("Commander could not be started:", tostring(err)));
}).catch((err) => warn("Centurion could not be started:", tostring(err)));
`} />

Types can also be registered manually through the
Expand Down
Loading

0 comments on commit 6557c30

Please sign in to comment.