45 个版本 (27 个稳定版本)

3.7.1 2024 年 5 月 29 日
3.6.3 2024 年 2 月 2 日
3.6.2 2023 年 10 月 15 日
3.6.1 2023 年 7 月 7 日
0.2.1 2021 年 3 月 31 日

#112 in 命令行界面

Download history 158/week @ 2024-05-11 25/week @ 2024-05-18 294/week @ 2024-05-25 46/week @ 2024-06-01 11/week @ 2024-06-08 2/week @ 2024-06-15 11/week @ 2024-06-29 19/week @ 2024-07-20 186/week @ 2024-07-27

每月 205 次下载

GPL-2.0-only

63KB
1.5K SLoC

crates.io version crates.io downloads docs.rs docs discord badge

Sigi CLI

sigi 是为讨厌整理的终端爱好者提供的整理工具

sigi 用作额外内存。用它来将你的任务、购物清单或你想要玩的下一款桌游放入堆栈中。鼓励使用 shell 别名来整理你的各种堆栈。


$ sigi -h
An organizing tool for terminal lovers who hate organizing

Usage: sigi [OPTIONS] [COMMAND]

Commands:
  interactive  Run in an interactive mode [aliases: i]
  -            Read input lines from standard input. Same commands as interactive mode, but only prints for printing commands. Intended for use in unix pipes
  complete     Move the current item to "<STACK>_history" and mark as completed [aliases: done, finish, fulfill]
  count        Print the total number of items in the stack [aliases: size, length]
  delete       Move the current item to "<STACK>_history" and mark as deleted [aliases: pop, remove, cancel, drop]
  delete-all   Move all items to "<STACK>_history" and mark as deleted [aliases: purge, pop-all, remove-all, cancel-all, drop-all]
  edit         Edit the content of an item. Other metadata like creation date is left unchanged
  head         Print the first N items (default is 10) [aliases: top, first]
  is-empty     Print "true" if stack has zero items, or print "false" (and exit with a nonzero exit code) if the stack does have items [aliases: empty]
  list         Print all items [aliases: ls, snoop, all]
  list-stacks  Print all stacks [aliases: stacks]
  move         Move current item to another stack
  move-all     Move all items to another stack
  next         Cycle to the next item; the current item becomes last [aliases: later, cycle, bury]
  peek         Print the first item. This is the default CLI behavior when no command is given [aliases: show]
  pick         Move items to the top of stack by their number
  push         Create a new item [aliases: create, add, do, start, new]
  rot          Rotate the three most-current items [aliases: rotate]
  swap         Swap the two most-current items
  tail         Print the last N items (default is 10) [aliases: bottom, last]
  help         Print this message or the help of the given subcommand(s)

Options:
  -q, --quiet                    Omit any leading labels or symbols. Recommended for use in shell scripts
  -s, --silent                   Omit any output at all
  -v, --verbose                  Print more information, like when an item was created [aliases: noisy]
  -f, --format <FORMAT>          Use a programmatic format. Options include [csv, json, json-compact, tsv]. Not compatible with quiet/silent/verbose [possible values: csv, json, json-compact, tsv]
  -t, --stack <STACK>            Manage items in a specific stack [aliases: topic, about, namespace]
  -d, --data-store <DATA_STORE>  (Advanced) Manage sigi stacks in a specific directory. The default is either the value of a SIGI_HOME environment variable or your OS-specific home directory [aliases: dir, directory, store]
  -h, --help                     Print help (see more with '--help')
  -V, --version                  Print version

INTERACTIVE MODE:

Use subcommands in interactive mode directly. No OPTIONS (flags) are understood in interactive mode. The ; character can be used to separate commands.

The following additional commands are available:
    ?               Show the short version of "help"
    clear           Clear the terminal screen
    use             Change to the specified stack [aliases: stack]
    exit            Quit interactive mode [aliases: quit, q]

示例

sigi 作为待办事项列表

sigi 可以理解 do(创建任务)和 done(完成任务)。

$ alias todo='sigi --stack todo'

$ todo do Write some code
Creating: Write some code

$ todo do Get a drink
Creating: Get a drink

$ todo do Take a nap
Creating: Take a nap

$ todo list
Now: Take a nap
  1: Get a drink
  2: Write some code

$ sleep 20m

$ todo done
Completed: Take a nap

最好在几个具有独特“堆栈”的别名后面使用 sigi。你应该将这些别名保存在你的 ~/.bashrc~/.zshrc 或你的 shell 的配置文件中。 sigi 接受 --stack 选项,你可以根据需要命名尽可能多的堆栈。

忘记了接下来要做什么吗?

$ todo
Now: Get a drink

不想做吗?

$ todo delete
Deleted: Get a drink

sigi 作为保存任何内容的列表

扩展别名概念,你可以使用 sigi 来存储你想要稍后记住的任何内容。

$ alias watch-later='sigi --stack watch-later'

$ watch-later add One Punch Man
Creating: One Punch Man
$ alias story-ideas='sigi --stack=story-ideas'

$ story-ideas add Alien race lives backwards through time.
Creating: Alien race lives backwards through time.

sigi 通过 ssh 远程访问

如果你有一个可以远程访问的主机,例如使用 OpenSSH 这样的工具,你也可以在多台机器上使用 sigi。考虑使用以下这样的别名

$ alias home-todo='ssh -qt [email protected] sigi --stack=home-todo'

技巧:如果你通过 SSH 进行大量机器跳转,请考虑在 $HOME/.ssh/config 中添加主机别名。我设置这些别名的方式如下

Host hq
    User boonieppper
    HostName 192.168.x.x
    IdentityFile ~/.ssh/etc

这允许你只需运行 ssh hq,例如。

sigi 作为基于本地堆栈的数据库

sigi 理解程序员熟悉的 pushpop 语法。它可以用于简单、持久、小规模的堆栈用例。

建议在 shell 脚本中使用 --quiet(或 -q)标志,因为它省略了任何前缀标签或符号。如果与管道一起使用,建议使用 - 子命令从标准输入读取,并且仅在请求的操作是打印操作(如 list)时打印。

sigi 非常快:对于基本用例,只需亚毫秒。但请注意,它不适合处理大量数据或并发吞吐量。如果您需要更强大的堆栈语义,请查看 Redis。

安装

Packaging status

如果您的打包系统还没有,最佳方式是通过 Rust 语言包管理器 cargo 安装 sigi

cargo install sigi

有关安装 cargo 的说明,请参阅此处

请为您的 Linux/BSD 等发行版打包。

贡献和支持

如果您发现错误或有想法,请打开一个 issue

我在寻找使用 sigi wiki 分享他们的技巧、窍门和示例的人。

谢谢您查看!

依赖关系

~11–21MB
~286K SLoC