Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小七de尾巴
Abc-imp
提交
e2f5e059
A
Abc-imp
项目概览
小七de尾巴
/
Abc-imp
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
Abc-imp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
e2f5e059
编写于
7月 19, 2017
作者:
A
Avi Aryan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
show all fields in app command #60
上级
3aa77c1d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
2 deletion
+30
-2
appbase/app/app.go
appbase/app/app.go
+15
-2
appbase/common/utils.go
appbase/common/utils.go
+15
-0
未找到文件。
appbase/app/app.go
浏览文件 @
e2f5e059
...
...
@@ -12,6 +12,7 @@ import (
"net/http"
"os"
"strconv"
"time"
)
type
appBody
struct
{
...
...
@@ -26,8 +27,11 @@ type respBody struct {
}
type
appDetailBody
struct
{
AppName
string
`json:"appname"`
ESVersion
string
`json:"es_version"`
AppName
string
`json:"appname"`
ESVersion
string
`json:"es_version"`
Owner
string
`json:"owner"`
Users
[]
string
`json:"users"`
CreatedAt
time
.
Time
`json:"created_at, string"`
}
type
appRespBody
struct
{
...
...
@@ -100,10 +104,19 @@ func ShowAppDetails(app string, perms bool, metrics bool) error {
if
err
!=
nil
{
return
err
}
// prepare output
common
.
RemoveDuplicates
(
&
res
.
Body
.
Users
)
users
:=
""
for
_
,
user
:=
range
res
.
Body
.
Users
{
users
+=
user
+
", "
}
// output
fmt
.
Printf
(
"ID: %s
\n
"
,
app
)
fmt
.
Printf
(
"Name: %s
\n
"
,
res
.
Body
.
AppName
)
fmt
.
Printf
(
"Owner: %s
\n
"
,
res
.
Body
.
Owner
)
fmt
.
Printf
(
"Users: %s
\n
"
,
users
[
:
len
(
users
)
-
2
])
fmt
.
Printf
(
"ES Version: %s
\n
"
,
res
.
Body
.
ESVersion
)
fmt
.
Printf
(
"Created on: %s
\n
"
,
res
.
Body
.
CreatedAt
.
Format
(
"Mon Jan _2 15:04:05 2006"
))
if
perms
{
err
=
ShowAppPerms
(
app
)
...
...
appbase/common/utils.go
浏览文件 @
e2f5e059
...
...
@@ -91,3 +91,18 @@ func IsFileValid(file string) error {
}
return
nil
}
// RemoveDuplicates removes duplicate values in a slice
// https://groups.google.com/forum/#!topic/golang-nuts/-pqkICuokio
func
RemoveDuplicates
(
xs
*
[]
string
)
{
found
:=
make
(
map
[
string
]
bool
)
j
:=
0
for
i
,
x
:=
range
*
xs
{
if
!
found
[
x
]
{
found
[
x
]
=
true
(
*
xs
)[
j
]
=
(
*
xs
)[
i
]
j
++
}
}
*
xs
=
(
*
xs
)[
:
j
]
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录