自动追踪使用应用程序的时间 Thyme

码农软件 · 软件分类 · 其他开发相关 · 2019-10-18 06:42:22

软件介绍

Thyme 可以自动追踪你使用应用程序的时间。

特性:

简单的命令行界面:

每 30s 记录一次你使用的应用

$ while true; do thyme track -o thyme.json; sleep 30s; done;

在新窗口创建图表以显示应用使用时间

$ thyme show -i thyme.json -w stats > thyme.html

安装:

安装 Go:

$ go get -u github.com/sourcegraph/thyme/cmd/thyme

按照 thyme.dep 打印的说明

$ thyme dep

校验 thyme

$ thyme track

使用示例

var trackCmd TrackCmd
func (c *TrackCmd) Execute(args []string) error {
t, err := getTracker()
if err != nil {
return err
}
snap, err := t.Snap()
if err != nil {
return err
}
if c.Out == "" {
out, err := json.MarshalIndent(snap, "", "  ")
if err != nil {
return err
}
fmt.Println(string(out))
} else {
var stream thyme.Stream
if _, err := os.Stat(c.Out); err == nil {
if err := func() error {
f, err := os.Open(c.Out)
if err != nil {
return err
}
defer f.Close()
if err := json.NewDecoder(f).Decode(&stream); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
} else if !os.IsNotExist(err) {
return err
}
stream.Snapshots = append(stream.Snapshots, snap)
f, err := os.Create(c.Out)
if err != nil {
return err
}
if err := json.NewEncoder(f).Encode(stream); err != nil {
return err
}
}
return nil
}

本文地址:https://codercto.com/soft/d/16999.html

The Everything Store

The Everything Store

Brad Stone / Little, Brown and Company / 2013-10-22 / USD 28.00

The definitive story of Amazon.com, one of the most successful companies in the world, and of its driven, brilliant founder, Jeff Bezos. Amazon.com started off delivering books through the mail. Bu......一起来看看 《The Everything Store》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

html转js在线工具
html转js在线工具

html转js在线工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换