Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
Coca
提交
d94523db
C
Coca
项目概览
Phodal
/
Coca
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Coca
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
d94523db
编写于
12月 25, 2019
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: make todos works
上级
c519f3d9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
62 addition
and
4 deletion
+62
-4
README.md
README.md
+25
-0
cmd/todo.go
cmd/todo.go
+12
-1
core/domain/todo/todo_app.go
core/domain/todo/todo_app.go
+25
-3
未找到文件。
README.md
浏览文件 @
d94523db
...
...
@@ -308,6 +308,31 @@ early [earlyRemoveWithException earlyRemoveAllWithException earlyRemoveAll early
evict [evictAll evictWithException evict evictEarly evictAllEarly]
```
### Todo
```
coca todo
```
results:
```
+------------+--------------+--------------------------------+---------------------------------------------------+-------+
| DATE | AUTHOR | MESSAGES | FILENAME | LINE |
+------------+--------------+--------------------------------+---------------------------------------------------+-------+
| 2019-12-19 | Phodal Huang | 支持 interface 在同一个包内 | core/adapter/api/JavaApiListener.go | 200 |
| 2019-12-21 | Phodal Huang | 处理链试调用 | core/adapter/bs/BadSmellListener.go | 305 |
| 2019-12-18 | Phodal Huang | update this reflect | core/adapter/bs/BadSmellListener.go | 363 |
| 2019-12-15 | Phodal Huang | update for array | core/adapter/bs/BadSmellListener.go | 388 |
| 2019-12-24 | Phodal Huang | 支持依赖注入 | core/adapter/call/JavaCallListener.go | 108 |
| 2019-12-24 | Phodal Huang | add inner creator examples | core/adapter/call/JavaCallListener.go | 209 |
| 2019-12-24 | Phodal Huang | add inner creator examples | core/adapter/call/JavaCallListener.go | 215 |
| 2019-12-24 | Phodal Huang | | core/adapter/call/JavaCallListener.go | 270 |
| 2019-12-20 | Phodal Huang | 处理链试调用 | core/adapter/call/JavaCallListener.go | 324 |
+------------+--------------+--------------------------------+---------------------------------------------------+-------+
```
## Dev
Install Go
...
...
cmd/todo.go
浏览文件 @
d94523db
package
cmd
import
(
"github.com/olekukonko/tablewriter"
"github.com/phodal/coca/core/domain/todo"
"github.com/spf13/cobra"
"os"
"strings"
)
type
RootCmdConfig
struct
{
...
...
@@ -21,7 +24,15 @@ var todoCmd = &cobra.Command{
path
:=
cmd
.
Flag
(
"path"
)
.
Value
.
String
()
if
path
!=
""
{
app
:=
todo
.
NewTodoApp
()
app
.
AnalysisPath
(
path
)
todos
:=
app
.
AnalysisPath
(
path
)
table
:=
tablewriter
.
NewWriter
(
os
.
Stdout
)
table
.
SetHeader
([]
string
{
"Date"
,
"Author"
,
"Messages"
,
"FileName"
,
"Line"
})
for
_
,
todo
:=
range
todos
{
table
.
Append
([]
string
{
todo
.
Date
,
todo
.
Author
,
strings
.
Join
(
todo
.
Message
,
"
\n
"
),
todo
.
FileName
,
todo
.
Line
})
}
table
.
Render
()
}
},
}
...
...
core/domain/todo/todo_app.go
浏览文件 @
d94523db
package
todo
import
(
"fmt"
"github.com/phodal/coca/core/domain/gitt"
"github.com/phodal/coca/core/domain/todo/astitodo"
"log"
...
...
@@ -19,7 +18,17 @@ func NewTodoApp() TodoApp {
}
}
func
(
a
TodoApp
)
AnalysisPath
(
path
string
)
{
type
TodoDetail
struct
{
Date
string
FileName
string
Author
string
Line
string
Assignee
string
Message
[]
string
}
func
(
a
TodoApp
)
AnalysisPath
(
path
string
)
[]
TodoDetail
{
var
todoList
[]
TodoDetail
=
nil
todos
,
err
:=
astitodo
.
Extract
(
path
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
...
...
@@ -27,12 +36,25 @@ func (a TodoApp) AnalysisPath(path string) {
for
_
,
todo
:=
range
todos
{
lineOutput
:=
runGitGetLog
(
todo
.
Line
,
todo
.
Filename
)
todoDetail
:=
&
TodoDetail
{
Date
:
""
,
FileName
:
todo
.
Filename
,
Author
:
""
,
Line
:
strconv
.
Itoa
(
todo
.
Line
),
Assignee
:
todo
.
Assignee
,
Message
:
todo
.
Message
,
}
commitMessages
:=
gitt
.
BuildMessageByInput
(
lineOutput
)
if
len
(
commitMessages
)
>
0
{
commit
:=
commitMessages
[
0
]
fmt
.
Println
(
commit
.
Date
,
todo
.
Filename
,
commit
.
Author
,
todo
.
Line
)
todoDetail
.
Date
=
commit
.
Date
todoDetail
.
Author
=
commit
.
Author
}
todoList
=
append
(
todoList
,
*
todoDetail
)
}
return
todoList
}
func
runGitGetLog
(
line
int
,
fileName
string
)
string
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录