From 56d8fe4a22b0f20da94036d80b531e1ec88d9aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 16 Feb 2015 07:40:21 +0100 Subject: [PATCH] Small changes to CLI commands PR --- main.go | 9 +++++++-- pkg/cmd/accounts.go | 12 +++++++----- pkg/cmd/dashboard.go | 2 +- pkg/cmd/datasource.go | 9 +++++---- pkg/services/sqlstore/account.go | 1 - pkg/setting/setting.go | 1 - 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/main.go b/main.go index 287ba9aa348..6701a5d7c08 100644 --- a/main.go +++ b/main.go @@ -32,9 +32,14 @@ func main() { app.Usage = "grafana web" app.Version = version app.Commands = []cli.Command{ - cmd.ListAccounts, cmd.CreateAccount, cmd.DeleteAccount, + cmd.ListAccounts, + cmd.CreateAccount, + cmd.DeleteAccount, cmd.ImportDashboard, - cmd.ListDataSources, cmd.CreateDataSource, cmd.DescribeDataSource, cmd.DeleteDataSource, + cmd.ListDataSources, + cmd.CreateDataSource, + cmd.DescribeDataSource, + cmd.DeleteDataSource, cmd.Web} app.Flags = append(app.Flags, []cli.Flag{ cli.StringFlag{ diff --git a/pkg/cmd/accounts.go b/pkg/cmd/accounts.go index 8758cb06e11..aeda7efed9b 100644 --- a/pkg/cmd/accounts.go +++ b/pkg/cmd/accounts.go @@ -2,31 +2,33 @@ package cmd import ( "fmt" + "os" + "text/tabwriter" + "github.com/codegangsta/cli" + "github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/log" m "github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/setting" - "os" - "text/tabwriter" ) var ListAccounts = cli.Command{ - Name: "account", + Name: "accounts", Usage: "list accounts", Description: "Lists the accounts in the system", Action: listAccounts, } var CreateAccount = cli.Command{ - Name: "account:create", + Name: "accounts:create", Usage: "create a new account", Description: "Creates a new account", Action: createAccount, } var DeleteAccount = cli.Command{ - Name: "account:delete", + Name: "accounts:delete", Usage: "delete an existing account", Description: "Deletes an existing account", Action: deleteAccount, diff --git a/pkg/cmd/dashboard.go b/pkg/cmd/dashboard.go index eaae9700164..43714eb8e93 100644 --- a/pkg/cmd/dashboard.go +++ b/pkg/cmd/dashboard.go @@ -13,7 +13,7 @@ import ( ) var ImportDashboard = cli.Command{ - Name: "dashboard:import", + Name: "dashboards:import", Usage: "imports dashboards in JSON from a directory", Description: "Starts Grafana import process", Action: runImport, diff --git a/pkg/cmd/datasource.go b/pkg/cmd/datasource.go index bdd458e2b5d..660e59a9702 100644 --- a/pkg/cmd/datasource.go +++ b/pkg/cmd/datasource.go @@ -2,23 +2,24 @@ package cmd import ( "fmt" + "os" + "text/tabwriter" + "github.com/codegangsta/cli" "github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/log" m "github.com/grafana/grafana/pkg/models" - "os" - "text/tabwriter" ) var ( ListDataSources = cli.Command{ - Name: "datasource", + Name: "datasources", Usage: "list datasources", Description: "Lists the datasources in the system", Action: listDatasources, } CreateDataSource = cli.Command{ - Name: "datasource:create", + Name: "datasources:create", Usage: "creates a new datasource", Description: "Creates a new datasource", Action: createDataSource, diff --git a/pkg/services/sqlstore/account.go b/pkg/services/sqlstore/account.go index 7cd24c67c68..7eb6c79fae5 100644 --- a/pkg/services/sqlstore/account.go +++ b/pkg/services/sqlstore/account.go @@ -119,7 +119,6 @@ func DeleteAccount(cmd *m.DeleteAccountCommand) error { "DELETE FROM api_key WHERE account_id = ?", "DELETE FROM data_source WHERE account_id = ?", "DELETE FROM account_user WHERE account_id = ?", - "DELETE FROM user WHERE account_id = ?", "DELETE FROM account WHERE id = ?", } diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 01e368abc6f..241f820ca6b 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -171,7 +171,6 @@ func NewConfigContext(config string) { configFiles = append(configFiles, config) } - //log.Info("Loading config files: %v", configFiles) var err error for i, file := range configFiles {