jaggy/work-scripts

我工作用到的脚本。

0.4.4 2016-08-10 06:33 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:58:30 UTC


README

这是一个小型的库,可以让工作更加轻松。

我所在的公司严重依赖Basecamp来记录工作时间。所以我编写了一个小的命令行脚本来仅使用git提交来记录时间。

依赖项

  • sleepwatcher
  • php >= 5.5

安装

您可以使用composer安装这些脚本。

composer global require jaggy/work-scripts

使用方法

在我深入探讨细节之前,让我们先展示一下它是如何工作的。

$ work time:log

Yow! ( ̄^ ̄)ゞ
Which project would you like to add an entry to? [It might take a while to fetch the project list]
1: xxxxxxxxxxxxxxxxxxxxxxx
2: xxxxxxxxxxxxxxxxxxxxxxx
3: xxxxxxxxxxxxxxxxxxxxxxx
4: xxxxxxxxxxxxxxxxxxxxxxx
Enter the id of the project: [Leave blank to cancel]: 2
Log description []: Update the project readme.
How many hours did this task take? [2.25 hours remaining]]: 2
Project ID: xxxxxxxxxxx
Log Description: Update the project readme
Rendered Hours: 0.2
Is the provided data correct? [n] y
Sending the data to basecamp...
Time is now logged! You're good to go! (╯°□°)╯︵ ┻━┻

此外,您还可以强制参数。这正是git钩子使一切变得简单的原因。

work time:log --project=<PROJECT_ID> --description="Log Entry" --hours=1.0

基本上,这就是它的工作方式。

配置

设置Basecamp

~/.workrc

为了使工作脚本工作,您需要在主目录中注册您的环境~/.workrc

BASECAMP_URL=null
BASECAMP_USERNAME=null
BASECAMP_PASSWORD=null

初始化项目

要初始化您的项目,只需运行work init。然后,它将执行以下操作:

  • .work注册到您的.gitignore中。
  • 在项目根目录中创建一个.work文件。
  • 询问您想要将哪个Basecamp项目与该项目关联,并将其注册到工作配置中。
  • 询问您是否想为日志添加前缀。
  • post-commit git钩子注册到您的项目中。

命令

笔记

获取当前的SSID

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'

待办事项

  • 添加缓存以避免对Basecamp进行重复请求。
  • 添加离线处理程序,在检测到互联网连接后发送Basecamp日志。