Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
07be2c89
Commit
07be2c89
authored
Jun 24, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tech(cli): lets use the fact that we have a compiler
parent
88e208bd
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
10 deletions
+29
-10
pkg/cmd/grafana-cli/commands/command_line.go
+11
-0
pkg/cmd/grafana-cli/commands/commandstest/fake_commandLine.go
+8
-0
pkg/cmd/grafana-cli/commands/install_command.go
+4
-4
pkg/cmd/grafana-cli/commands/listremote_command.go
+1
-1
pkg/cmd/grafana-cli/commands/ls_command.go
+1
-1
pkg/cmd/grafana-cli/commands/remove_command.go
+1
-1
pkg/cmd/grafana-cli/commands/upgrade_all_command.go
+1
-1
pkg/cmd/grafana-cli/commands/upgrade_command.go
+2
-2
No files found.
pkg/cmd/grafana-cli/commands/command_line.go
View file @
07be2c89
...
@@ -16,6 +16,9 @@ type CommandLine interface {
...
@@ -16,6 +16,9 @@ type CommandLine interface {
GlobalString
(
name
string
)
string
GlobalString
(
name
string
)
string
FlagNames
()
(
names
[]
string
)
FlagNames
()
(
names
[]
string
)
Generic
(
name
string
)
interface
{}
Generic
(
name
string
)
interface
{}
PluginDirectory
()
string
RepoDirectory
()
string
}
}
type
contextCommandLine
struct
{
type
contextCommandLine
struct
{
...
@@ -33,3 +36,11 @@ func (c *contextCommandLine) ShowVersion() {
...
@@ -33,3 +36,11 @@ func (c *contextCommandLine) ShowVersion() {
func
(
c
*
contextCommandLine
)
Application
()
*
cli
.
App
{
func
(
c
*
contextCommandLine
)
Application
()
*
cli
.
App
{
return
c
.
App
return
c
.
App
}
}
func
(
c
*
contextCommandLine
)
PluginDirectory
()
string
{
return
c
.
GlobalString
(
"pluginsDir"
)
}
func
(
c
*
contextCommandLine
)
RepoDirectory
()
string
{
return
c
.
GlobalString
(
"repo"
)
}
pkg/cmd/grafana-cli/commands/commandstest/fake_commandLine.go
View file @
07be2c89
...
@@ -93,3 +93,11 @@ func (fcli *FakeCommandLine) Args() cli.Args {
...
@@ -93,3 +93,11 @@ func (fcli *FakeCommandLine) Args() cli.Args {
func
(
fcli
*
FakeCommandLine
)
ShowVersion
()
{
func
(
fcli
*
FakeCommandLine
)
ShowVersion
()
{
fcli
.
VersionShown
=
true
fcli
.
VersionShown
=
true
}
}
func
(
fcli
*
FakeCommandLine
)
RepoDirectory
()
string
{
return
fcli
.
GlobalString
(
"repo"
)
}
func
(
fcli
*
FakeCommandLine
)
PluginDirectory
()
string
{
return
fcli
.
GlobalString
(
"pluginsDir"
)
}
pkg/cmd/grafana-cli/commands/install_command.go
View file @
07be2c89
...
@@ -25,7 +25,7 @@ func validateInput(c CommandLine, pluginFolder string) error {
...
@@ -25,7 +25,7 @@ func validateInput(c CommandLine, pluginFolder string) error {
return
errors
.
New
(
"please specify plugin to install"
)
return
errors
.
New
(
"please specify plugin to install"
)
}
}
pluginsDir
:=
c
.
GlobalString
(
"pluginsDir"
)
pluginsDir
:=
c
.
PluginDirectory
(
)
if
pluginsDir
==
""
{
if
pluginsDir
==
""
{
return
errors
.
New
(
"missing pluginsDir flag"
)
return
errors
.
New
(
"missing pluginsDir flag"
)
}
}
...
@@ -46,7 +46,7 @@ func validateInput(c CommandLine, pluginFolder string) error {
...
@@ -46,7 +46,7 @@ func validateInput(c CommandLine, pluginFolder string) error {
}
}
func
installCommand
(
c
CommandLine
)
error
{
func
installCommand
(
c
CommandLine
)
error
{
pluginFolder
:=
c
.
GlobalString
(
"pluginsDir"
)
pluginFolder
:=
c
.
PluginDirectory
(
)
if
err
:=
validateInput
(
c
,
pluginFolder
);
err
!=
nil
{
if
err
:=
validateInput
(
c
,
pluginFolder
);
err
!=
nil
{
return
err
return
err
}
}
...
@@ -58,8 +58,8 @@ func installCommand(c CommandLine) error {
...
@@ -58,8 +58,8 @@ func installCommand(c CommandLine) error {
}
}
func
InstallPlugin
(
pluginName
,
version
string
,
c
CommandLine
)
error
{
func
InstallPlugin
(
pluginName
,
version
string
,
c
CommandLine
)
error
{
plugin
,
err
:=
s
.
GetPlugin
(
pluginName
,
c
.
GlobalString
(
"repo"
))
plugin
,
err
:=
s
.
GetPlugin
(
pluginName
,
c
.
RepoDirectory
(
))
pluginFolder
:=
c
.
GlobalString
(
"pluginsDir"
)
pluginFolder
:=
c
.
PluginDirectory
(
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
pkg/cmd/grafana-cli/commands/listremote_command.go
View file @
07be2c89
...
@@ -6,7 +6,7 @@ import (
...
@@ -6,7 +6,7 @@ import (
)
)
func
listremoteCommand
(
c
CommandLine
)
error
{
func
listremoteCommand
(
c
CommandLine
)
error
{
plugin
,
err
:=
s
.
ListAllPlugins
(
c
.
GlobalString
(
"repo"
))
plugin
,
err
:=
s
.
ListAllPlugins
(
c
.
RepoDirectory
(
))
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
pkg/cmd/grafana-cli/commands/ls_command.go
View file @
07be2c89
...
@@ -32,7 +32,7 @@ var validateLsCommand = func(pluginDir string) error {
...
@@ -32,7 +32,7 @@ var validateLsCommand = func(pluginDir string) error {
}
}
func
lsCommand
(
c
CommandLine
)
error
{
func
lsCommand
(
c
CommandLine
)
error
{
pluginDir
:=
c
.
GlobalString
(
"pluginsDir"
)
pluginDir
:=
c
.
PluginDirectory
(
)
if
err
:=
validateLsCommand
(
pluginDir
);
err
!=
nil
{
if
err
:=
validateLsCommand
(
pluginDir
);
err
!=
nil
{
return
err
return
err
}
}
...
...
pkg/cmd/grafana-cli/commands/remove_command.go
View file @
07be2c89
...
@@ -12,7 +12,7 @@ var getPluginss func(path string) []m.InstalledPlugin = services.GetLocalPlugins
...
@@ -12,7 +12,7 @@ var getPluginss func(path string) []m.InstalledPlugin = services.GetLocalPlugins
var
removePlugin
func
(
pluginPath
,
id
string
)
error
=
services
.
RemoveInstalledPlugin
var
removePlugin
func
(
pluginPath
,
id
string
)
error
=
services
.
RemoveInstalledPlugin
func
removeCommand
(
c
CommandLine
)
error
{
func
removeCommand
(
c
CommandLine
)
error
{
pluginPath
:=
c
.
GlobalString
(
"pluginsDir"
)
pluginPath
:=
c
.
PluginDirectory
(
)
localPlugins
:=
getPluginss
(
pluginPath
)
localPlugins
:=
getPluginss
(
pluginPath
)
plugin
:=
c
.
Args
()
.
First
()
plugin
:=
c
.
Args
()
.
First
()
...
...
pkg/cmd/grafana-cli/commands/upgrade_all_command.go
View file @
07be2c89
...
@@ -28,7 +28,7 @@ func ShouldUpgrade(installed string, remote m.Plugin) bool {
...
@@ -28,7 +28,7 @@ func ShouldUpgrade(installed string, remote m.Plugin) bool {
}
}
func
upgradeAllCommand
(
c
CommandLine
)
error
{
func
upgradeAllCommand
(
c
CommandLine
)
error
{
pluginsDir
:=
c
.
GlobalString
(
"pluginsDir"
)
pluginsDir
:=
c
.
PluginDirectory
(
)
localPlugins
:=
s
.
GetLocalPlugins
(
pluginsDir
)
localPlugins
:=
s
.
GetLocalPlugins
(
pluginsDir
)
...
...
pkg/cmd/grafana-cli/commands/upgrade_command.go
View file @
07be2c89
...
@@ -7,7 +7,7 @@ import (
...
@@ -7,7 +7,7 @@ import (
)
)
func
upgradeCommand
(
c
CommandLine
)
error
{
func
upgradeCommand
(
c
CommandLine
)
error
{
pluginsDir
:=
c
.
GlobalString
(
"pluginsDir"
)
pluginsDir
:=
c
.
PluginDirectory
(
)
pluginName
:=
c
.
Args
()
.
First
()
pluginName
:=
c
.
Args
()
.
First
()
localPlugin
,
err
:=
s
.
ReadPlugin
(
pluginsDir
,
pluginName
)
localPlugin
,
err
:=
s
.
ReadPlugin
(
pluginsDir
,
pluginName
)
...
@@ -16,7 +16,7 @@ func upgradeCommand(c CommandLine) error {
...
@@ -16,7 +16,7 @@ func upgradeCommand(c CommandLine) error {
return
err
return
err
}
}
v
,
err2
:=
s
.
GetPlugin
(
localPlugin
.
Id
,
c
.
GlobalString
(
"repo"
))
v
,
err2
:=
s
.
GetPlugin
(
localPlugin
.
Id
,
c
.
RepoDirectory
(
))
if
err2
!=
nil
{
if
err2
!=
nil
{
return
err2
return
err2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment