Commit 56d8fe4a by Torkel Ödegaard

Small changes to CLI commands PR

parent b6428b08
...@@ -32,9 +32,14 @@ func main() { ...@@ -32,9 +32,14 @@ func main() {
app.Usage = "grafana web" app.Usage = "grafana web"
app.Version = version app.Version = version
app.Commands = []cli.Command{ app.Commands = []cli.Command{
cmd.ListAccounts, cmd.CreateAccount, cmd.DeleteAccount, cmd.ListAccounts,
cmd.CreateAccount,
cmd.DeleteAccount,
cmd.ImportDashboard, cmd.ImportDashboard,
cmd.ListDataSources, cmd.CreateDataSource, cmd.DescribeDataSource, cmd.DeleteDataSource, cmd.ListDataSources,
cmd.CreateDataSource,
cmd.DescribeDataSource,
cmd.DeleteDataSource,
cmd.Web} cmd.Web}
app.Flags = append(app.Flags, []cli.Flag{ app.Flags = append(app.Flags, []cli.Flag{
cli.StringFlag{ cli.StringFlag{
......
...@@ -2,31 +2,33 @@ package cmd ...@@ -2,31 +2,33 @@ package cmd
import ( import (
"fmt" "fmt"
"os"
"text/tabwriter"
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
"github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/log" "github.com/grafana/grafana/pkg/log"
m "github.com/grafana/grafana/pkg/models" m "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"os"
"text/tabwriter"
) )
var ListAccounts = cli.Command{ var ListAccounts = cli.Command{
Name: "account", Name: "accounts",
Usage: "list accounts", Usage: "list accounts",
Description: "Lists the accounts in the system", Description: "Lists the accounts in the system",
Action: listAccounts, Action: listAccounts,
} }
var CreateAccount = cli.Command{ var CreateAccount = cli.Command{
Name: "account:create", Name: "accounts:create",
Usage: "create a new account", Usage: "create a new account",
Description: "Creates a new account", Description: "Creates a new account",
Action: createAccount, Action: createAccount,
} }
var DeleteAccount = cli.Command{ var DeleteAccount = cli.Command{
Name: "account:delete", Name: "accounts:delete",
Usage: "delete an existing account", Usage: "delete an existing account",
Description: "Deletes an existing account", Description: "Deletes an existing account",
Action: deleteAccount, Action: deleteAccount,
......
...@@ -13,7 +13,7 @@ import ( ...@@ -13,7 +13,7 @@ import (
) )
var ImportDashboard = cli.Command{ var ImportDashboard = cli.Command{
Name: "dashboard:import", Name: "dashboards:import",
Usage: "imports dashboards in JSON from a directory", Usage: "imports dashboards in JSON from a directory",
Description: "Starts Grafana import process", Description: "Starts Grafana import process",
Action: runImport, Action: runImport,
......
...@@ -2,23 +2,24 @@ package cmd ...@@ -2,23 +2,24 @@ package cmd
import ( import (
"fmt" "fmt"
"os"
"text/tabwriter"
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
"github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/log" "github.com/grafana/grafana/pkg/log"
m "github.com/grafana/grafana/pkg/models" m "github.com/grafana/grafana/pkg/models"
"os"
"text/tabwriter"
) )
var ( var (
ListDataSources = cli.Command{ ListDataSources = cli.Command{
Name: "datasource", Name: "datasources",
Usage: "list datasources", Usage: "list datasources",
Description: "Lists the datasources in the system", Description: "Lists the datasources in the system",
Action: listDatasources, Action: listDatasources,
} }
CreateDataSource = cli.Command{ CreateDataSource = cli.Command{
Name: "datasource:create", Name: "datasources:create",
Usage: "creates a new datasource", Usage: "creates a new datasource",
Description: "Creates a new datasource", Description: "Creates a new datasource",
Action: createDataSource, Action: createDataSource,
......
...@@ -119,7 +119,6 @@ func DeleteAccount(cmd *m.DeleteAccountCommand) error { ...@@ -119,7 +119,6 @@ func DeleteAccount(cmd *m.DeleteAccountCommand) error {
"DELETE FROM api_key WHERE account_id = ?", "DELETE FROM api_key WHERE account_id = ?",
"DELETE FROM data_source WHERE account_id = ?", "DELETE FROM data_source WHERE account_id = ?",
"DELETE FROM account_user WHERE account_id = ?", "DELETE FROM account_user WHERE account_id = ?",
"DELETE FROM user WHERE account_id = ?",
"DELETE FROM account WHERE id = ?", "DELETE FROM account WHERE id = ?",
} }
......
...@@ -171,7 +171,6 @@ func NewConfigContext(config string) { ...@@ -171,7 +171,6 @@ func NewConfigContext(config string) {
configFiles = append(configFiles, config) configFiles = append(configFiles, config)
} }
//log.Info("Loading config files: %v", configFiles)
var err error var err error
for i, file := range configFiles { for i, file := range configFiles {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment