ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
* [sisyphus] ztodo: command-line pwd-based todo list manager for zsh users
@ 2009-07-02 14:23 Alexey I. Froloff
  2009-07-02 15:14 ` Afanasov Dmitry
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Alexey I. Froloff @ 2009-07-02 14:23 UTC (permalink / raw)
  To: ALT Linux Sisyphus discussion list


[-- Attachment #1.1: Type: text/plain, Size: 1419 bytes --]

Сначала расскажу зачем я это сделал.

Собираю Ruby 1.9.1.  Процесс этот небыстрый, происходит в N
приёмов.  Сначала убираются анметы и пакет ruby генерит несколько
(десятков) compat пакетов.  На втором шаге compat пакеты
убираются.  Попутно находятся мелкие недоделки, которые в данный
момент большого рояля не играют, но их было бы неплохо устранить.
Поскольку после пакета ruby идёт длинная простыня других пакетов,
то при каких-то изменениях в пакете ruby надо пересобрать и эту
простыню, поэтому несущественные изменения откладываются
"напотом".

Естественно, я не могу всего запомнить.  Держать TODO в каких-то
файликах и периодически туда заглядывать мне лень.  Значит
напоминалка должна орать когда я захожу в git репозитарий ruby.

Кладём приаттаченый файлик в $fpath, в ~/zshrc добавляем:

autoload -Uz ztodo
chpwd() { ztodo }

Usage:

ztodo
  Показать summary.
ztodo add текст
  Добавить entry.
ztodo list
  Показать список.
ztodo del номер
  Удалить entry.
ztodo clear
  Очистить список.

Работает со списком для текущего каталога.  Сам список хранится в
файле ~/.ztodolist, никакого мусора в других каталогах!

Ну и для наглядности скриншот напоминания:

raorn@centaurus:pts/8 ~ $ cd src 
You have 3 things to do here.
raorn@centaurus:pts/8 ~/src $ ztodo list
 1: Collect underpants
 2: ?
 3: PROFIT!
raorn@centaurus:pts/8 ~/src $ 

-- 
Regards,
Sir Raorn.

[-- Attachment #1.2: ztodo --]
[-- Type: text/plain, Size: 1395 bytes --]

# vim: set ft=zsh et sw=2 sts=2:

emulate -L zsh
setopt no_sh_word_split null_glob no_ksh_arrays
typeset -gHA __ztodolist
typeset -gH __ztodolaswrite
local cachefile short_format list_format
local tmp needupdate=0
local -a todos

zstyle -s ':ztodo:*' cache-file cachefile ||
  cachefile="~/.ztodolist"
zstyle -s ':ztodo:*' short-format short_format ||
  short_format="You have %n thing%1(n..s) to do here."
zstyle -s ':ztodo:*' list-format list_format ||
  list_format="%-2n: %e"

tmp=(${~tmp::=$cachefile(ms-$(( ${(%)tmp::="%D{%s}"} - ${__ztodolaswrite:-0} )))})
(( $#tmp )) &&
  . ${~cachefile}

todos=( ${(ps:\0:)__ztodolist[$PWD]} )

if (( $# )); then
  case "$1" in
    (add)
      shift
      todos=( $todos "$*" )
      needupdate=1
      ;;
    (del)
      shift
      todos[$1]=()
      needupdate=1
      ;;
    (clear)
      shift
      todos=()
      needupdate=1
      ;;
    (list)
      shift
      local i
      for (( i = 1; i <= $#todos; i++ )); do
        zformat -f tmp $list_format n:$i e:"$todos[$i]"
        print -P "$tmp"
      done
      ;;
  esac
else
  if [[ $#todos -gt 0 ]]; then
    zformat -f tmp $short_format n:$#todos
    print -P "$tmp"
  fi
fi

(( $#todos )) &&
  __ztodolist[$PWD]=${(pj:\0:)todos} ||
  unset "__ztodolist[$PWD]"
(( needupdate )) &&
  print -r "__ztodolist=( ${(kv@qq)^^__ztodolist} )" > ${~cachefile}
__ztodolaswrite="${(%)tmp::="%D{%s}"}"

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [sisyphus] ztodo: command-line pwd-based todo list manager for zsh users
  2009-07-02 14:23 [sisyphus] ztodo: command-line pwd-based todo list manager for zsh users Alexey I. Froloff
@ 2009-07-02 15:14 ` Afanasov Dmitry
  2009-07-02 15:21 ` Afanasov Dmitry
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Afanasov Dmitry @ 2009-07-02 15:14 UTC (permalink / raw)
  To: sisyphus

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

On Thu, Jul 02, 2009 at 06:23:23PM +0400, Alexey I. Froloff wrote:
> raorn@centaurus:pts/8 ~ $ cd src 
> You have 3 things to do here.
> raorn@centaurus:pts/8 ~/src $ ztodo list
>  1: Collect underpants
>  2: ?
>  3: PROFIT!
> raorn@centaurus:pts/8 ~/src $ 
черт, а удобно.
ну раз RROFIT, тогда ждем ебилдов^Wпакетов? :)
-- 
С уважением
Афанасов Дмитрий

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [sisyphus] ztodo: command-line pwd-based todo list manager for zsh users
  2009-07-02 14:23 [sisyphus] ztodo: command-line pwd-based todo list manager for zsh users Alexey I. Froloff
  2009-07-02 15:14 ` Afanasov Dmitry
@ 2009-07-02 15:21 ` Afanasov Dmitry
  2009-07-03  4:28 ` [sisyphus] [JT] " Ildar Mulyukov
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Afanasov Dmitry @ 2009-07-02 15:21 UTC (permalink / raw)
  To: sisyphus

[-- Attachment #1: Type: text/plain, Size: 181 bytes --]

On Thu, Jul 02, 2009 at 06:23:23PM +0400, Alexey I. Froloff wrote:
> raorn@centaurus:pts/8 ~/src $ ztodo list
осталось 
$ ztodo l<TAB>

:)
-- 
С уважением
Афанасов Дмитрий

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [sisyphus] [JT] ztodo: command-line pwd-based todo list manager for zsh users
  2009-07-02 14:23 [sisyphus] ztodo: command-line pwd-based todo list manager for zsh users Alexey I. Froloff
  2009-07-02 15:14 ` Afanasov Dmitry
  2009-07-02 15:21 ` Afanasov Dmitry
@ 2009-07-03  4:28 ` Ildar Mulyukov
  2009-07-03  8:15   ` Alexey Tourbin
  2009-07-06 22:45 ` [sisyphus] " Денис Смирнов
  2009-11-16 17:11 ` Slava Semushin
  4 siblings, 1 reply; 7+ messages in thread
From: Ildar Mulyukov @ 2009-07-03  4:28 UTC (permalink / raw)
  To: sisyphus

On 02.07.2009 20:23:23, Alexey I. Froloff wrote:
...
> Держать TODO в каких-то файликах и периодически туда заглядывать мне  
> лень.  Значит напоминалка должна орать когда я захожу в git  
> репозитарий ruby.

JFYI: Не-пользователи zsh могут соорудить что-нибудь похожее при помощи  
inotify-tools

Ильдар
-- 
Ildar  Mulyukov,  free SW designer/programmer/packager
=========================================
email: ildar@altlinux.ru
Jabber: ildar@jabber.ru
ICQ: 4334029
ALT Linux Sisyphus http://www.sisyphus.ru
=========================================


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [sisyphus] [JT] ztodo: command-line pwd-based todo list manager for zsh users
  2009-07-03  4:28 ` [sisyphus] [JT] " Ildar Mulyukov
@ 2009-07-03  8:15   ` Alexey Tourbin
  0 siblings, 0 replies; 7+ messages in thread
From: Alexey Tourbin @ 2009-07-03  8:15 UTC (permalink / raw)
  To: sisyphus

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

On Fri, Jul 03, 2009 at 10:28:40AM +0600, Ildar Mulyukov wrote:
> On 02.07.2009 20:23:23, Alexey I. Froloff wrote:
> ...
> >Держать TODO в каких-то файликах и 
> >периодически туда заглядывать мне  лень. 
> >Значит напоминалка должна орать когда я 
> >захожу в git  репозитарий ruby.
> 
> JFYI: Не-пользователи zsh могут соорудить 
> что-нибудь похожее при помощи  inotify-tools

И ещё при помощи Sun RPC.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [sisyphus] ztodo: command-line pwd-based todo list manager for zsh users
  2009-07-02 14:23 [sisyphus] ztodo: command-line pwd-based todo list manager for zsh users Alexey I. Froloff
                   ` (2 preceding siblings ...)
  2009-07-03  4:28 ` [sisyphus] [JT] " Ildar Mulyukov
@ 2009-07-06 22:45 ` Денис Смирнов
  2009-11-16 17:11 ` Slava Semushin
  4 siblings, 0 replies; 7+ messages in thread
From: Денис Смирнов @ 2009-07-06 22:45 UTC (permalink / raw)
  To: ALT Linux Sisyphus discussions

[-- Attachment #1: Type: text/plain, Size: 1629 bytes --]

On Thu, Jul 02, 2009 at 06:23:23PM +0400, Alexey I. Froloff wrote:

AIF> Сначала расскажу зачем я это сделал.
AIF> Естественно, я не могу всего запомнить.  Держать TODO в каких-то
AIF> файликах и периодически туда заглядывать мне лень.  Значит
AIF> напоминалка должна орать когда я захожу в git репозитарий ruby.

Гениально! Главное требование к любой системе напоминаний -- напоминания
должны быть к месту. 

AIF> Кладём приаттаченый файлик в $fpath, в ~/zshrc добавляем:
AIF> autoload -Uz ztodo
AIF> chpwd() { ztodo }

Комментарий -- в $fpath по-умолчанию нету ни одного каталога внутри $HOME,
а класть что-то неопакеченое в /usr/share -- нехорошо. Поэтому я сделал у
себя ~/bin/zsh, и в .zshrc написал еще:
fpath=($HOME/bin/zsh $fpath)

AIF> ztodo
AIF>   Показать summary.

У меня ничего не показывает.

AIF> ztodo add текст
AIF>   Добавить entry.
AIF> ztodo list
AIF>   Показать список.
AIF> ztodo del номер
AIF>   Удалить entry.
AIF> ztodo clear
AIF>   Очистить список.

Для полного счастья не хватает только опакетить, да вместе с
completion :)

AIF> Работает со списком для текущего каталога.  Сам список хранится в
AIF> файле ~/.ztodolist, никакого мусора в других каталогах!

Это не слишком важно если использовать только в ручном режиме, но все-таки
-- как насчет race'ов? Если одновременно с модификацией ручками какой-то
скриптик тоже вызовет ztodo?

[skip]

слушай, а по какой документации ты этому учился? Я ни строчки понять не
смог :(

-- 
С уважением, Денис

http://freesource.info
----------------------------------------------------------------------------

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [sisyphus] ztodo: command-line pwd-based todo list manager for zsh users
  2009-07-02 14:23 [sisyphus] ztodo: command-line pwd-based todo list manager for zsh users Alexey I. Froloff
                   ` (3 preceding siblings ...)
  2009-07-06 22:45 ` [sisyphus] " Денис Смирнов
@ 2009-11-16 17:11 ` Slava Semushin
  4 siblings, 0 replies; 7+ messages in thread
From: Slava Semushin @ 2009-11-16 17:11 UTC (permalink / raw)
  To: ALT Linux Sisyphus discussions

2 июля 2009 г. 20:23 пользователь Alexey I. Froloff
<raorn@altlinux.org> написал:
[...]

BTW, возможно, кого-нибудь заинтересует
http://www.todotxt.com/library/todo.sh/ и он его даже упакует в
Сизиф?.. :)

[...]

-- 
Slava Semushin

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-11-16 17:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-02 14:23 [sisyphus] ztodo: command-line pwd-based todo list manager for zsh users Alexey I. Froloff
2009-07-02 15:14 ` Afanasov Dmitry
2009-07-02 15:21 ` Afanasov Dmitry
2009-07-03  4:28 ` [sisyphus] [JT] " Ildar Mulyukov
2009-07-03  8:15   ` Alexey Tourbin
2009-07-06 22:45 ` [sisyphus] " Денис Смирнов
2009-11-16 17:11 ` Slava Semushin

ALT Linux Sisyphus discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
		sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
	public-inbox-index sisyphus

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sisyphus


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git