Skip to main content

Uadmin command system intro

Uadmin provides interface to add easily your own commands, like: migrate data or anything you want.
Try to execute following command in your CLI

  ./uadmin_binary

You'll see all commands that registered in your application

Example

You can check example here. This is a command to create superuser for your project. To use it, execute following command:

  ./uadmin_binary superuser create -n {YOURUSERNAME} -e {USERNAMEEMAIL}

and provide a password for your user.

API

Each command has to implement following interface.
If you want to implement subcommands, then initialize CommandRegistry described here. Proceed method gets subaction as string and slice with args passed from cli.
Then do what you created the command for.

Register your command in app

After you added your own command, don't forget to register it in your app. An example is here
You can use application instance in your cmd, like it's shown here