質問編集履歴
2
zshの設定を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -5,6 +5,44 @@
|
|
5
5
|
|
6
6
|
|
7
7
|
上記urlの記事下部にある、zshで定義したtoggl_current()というtogglからタイムトラッキング情報を取得する関数が、シェルからコマンドを実施するたびに実行されて内容が更新されるようにしたい。
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
■現在の設定(.zshrc)
|
12
|
+
|
13
|
+
toggl_current() {
|
14
|
+
|
15
|
+
local tgc="$(toggl --cache --csv current)"
|
16
|
+
|
17
|
+
local tgc_time=$(echo $tgc | grep Duration | cut -d ',' -f 2)
|
18
|
+
|
19
|
+
local tgc_dsc=$(echo $tgc | grep Description | cut -d ',' -f 2 | cut -c 1-20)
|
20
|
+
|
21
|
+
local short_tgc_dsc=$(if [ $(echo $tgc_dsc | wc -m) -lt 20 ]; then echo $tgc_dsc; else echo "${tgc_dsc}.."; fi)
|
22
|
+
|
23
|
+
if [ ! -n "$tgc_time" ]; then
|
24
|
+
|
25
|
+
echo "NoTimeEntry"
|
26
|
+
|
27
|
+
else
|
28
|
+
|
29
|
+
echo "[$tgc_time $short_tgc_dsc]"
|
30
|
+
|
31
|
+
fi
|
32
|
+
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
# プロンプトを2行で表示、時刻を表示
|
38
|
+
|
39
|
+
PROMPT="%(?.%{${fg[green]}%}.%{${fg[red]}%})%n${reset_color}@${fg[blue]}%m${reset_color}(%*%) %~ $(toggl_current)
|
40
|
+
|
41
|
+
%# "
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
8
46
|
|
9
47
|
|
10
48
|
|
1
URLのタイトルを変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
**■目的**
|
2
2
|
|
3
|
-
[
|
3
|
+
[私のCLI仕事術](http://qiita.com/sachaos/items/ed06f09375b2cef55dda)
|
4
4
|
|
5
5
|
|
6
6
|
|