> For the complete documentation index, see [llms.txt](https://docs.polyfrost.org/oneconfig/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.polyfrost.org/oneconfig/commands/example.md).

# An Example Command

For if you are struggling to figure out how it works :)

```java
@Command(value = "oneconfig", aliases = {"ocfg"})
public class OneConfigCommand {

    @Main(description = "Opens the OneConfig GUI")
    private void main() {
        GuiUtils.displayScreen(OneConfigGui.create());
    }

    @SubCommand(description = "Opens the OneConfig HUD configurator.", aliases = {"edithud"})
    private void hud() {
        GuiUtils.displayScreen(new HudGui());
    }

    @SubCommand(description = "Destroy the currently open OneConfig GUI.")
    private void destroy() {
        OneConfigGui.INSTANCE = null;
    }

    @SubCommandGroup(value = "Profile", aliases = {"profiles"})
    private static class Profile {
        @SubCommand(description = "View all profiles", aliases = {"view"})
        private void list() {
            StringBuilder builder = new StringBuilder()
                    .append(ChatColor.GOLD).append("Available profiles:");
            for (String profile : Profiles.getProfiles()) {
                builder.append("\n");
                if (OneConfigConfig.currentProfile.equals(profile)) builder.append(ChatColor.GREEN);
                else builder.append(ChatColor.RED);
                builder.append(profile);
            }
            UChat.chat(builder.toString());
        }

        @SubCommand(description = "Switch to a Profile", aliases = {"enable", "set", "load", "switch"})
        private void switchProfile(@Description("Profile Name") @Greedy String profile) {
            if (!Profiles.doesProfileExist(profile)) {
                UChat.chat(ChatColor.RED + "The Profile \"" + profile + "\" does not exist!");
            } else {
                Profiles.loadProfile(profile);
                UChat.chat(ChatColor.GREEN + "Switched to the \"" + profile + "\" Profile.");
            }
        }

        @SubCommand(description = "Create a new Profile", aliases = {"make"})
        private void create(@Description("Profile Name") @Greedy String profile) {
            if (Profiles.doesProfileExist(profile)) {
                UChat.chat(ChatColor.RED + "The Profile \"" + profile + "\" already exists!");
            } else {
                Profiles.createProfile(profile);
                if (Profiles.doesProfileExist(profile)) Profiles.loadProfile(profile);
                UChat.chat(ChatColor.GREEN + "Created the \"" + profile + "\" Profile.");
            }
        }

        @SubCommand(description = "Rename a Profile")
        private void rename(@Description("Old name") String profile, @Description("New name") @Greedy String newName) {
            if (!Profiles.doesProfileExist(profile)) {
                UChat.chat(ChatColor.RED + "The Profile \"" + profile + "\" does not exist!");
            } else {
                Profiles.renameProfile(profile, newName);
                UChat.chat(ChatColor.GREEN + "Renamed the \"" + profile + "\" Profile to \" " + newName + "\".");
            }
        }

        @SubCommand(description = "Delete a Profile", aliases = {"remove", "destroy"})
        private void delete(@Description("Profile name") @Greedy String profile) {
            if (!Profiles.doesProfileExist(profile)) {
                UChat.chat(ChatColor.RED + "The Profile \"" + profile + "\" does not exist!");
            } else {
                Profiles.deleteProfile(profile);
                UChat.chat(ChatColor.GREEN + "Deleted the \"" + profile + "\" Profile.");
            }
        }
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.polyfrost.org/oneconfig/commands/example.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
