mirror of
https://github.com/zdharma-continuum/zconvey.git
synced 2026-09-10 07:06:21 -04:00
Compare commits
91 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
597d7c027c | ||
|
|
d151f1805e | ||
|
|
90e82e2022 | ||
|
|
96189b47a7 | ||
|
|
f95d026737 | ||
|
|
f81880cda3 | ||
|
|
372f505f21 | ||
|
|
851dbd7f60 | ||
|
|
627e8aff06 | ||
|
|
6df790888a | ||
|
|
95094ec162 | ||
|
|
f3e828fce4 | ||
|
|
232781ca82 | ||
|
|
945086f062 | ||
|
|
5e548862fc | ||
|
|
18103df319 | ||
|
|
3aef21260c | ||
|
|
e93731fe59 | ||
|
|
d2d34f934c | ||
|
|
5b88a12a3a | ||
|
|
d89c0bbbf4 | ||
|
|
e615e5c600 | ||
|
|
9b439e6e50 | ||
|
|
3f3ed54d23 | ||
|
|
9921e56efe | ||
|
|
d78f8efbe0 | ||
|
|
04a3b9ab8b | ||
|
|
c5f3099cbb | ||
|
|
2f02abe09f | ||
|
|
54fceaec7a | ||
|
|
adc7cb5447 | ||
|
|
1206924775 | ||
|
|
ce475add09 | ||
|
|
4b4139fd48 | ||
|
|
337d264b94 | ||
|
|
4483a1edc8 | ||
|
|
0808de2992 | ||
|
|
1aa961317c | ||
|
|
dc11081777 | ||
|
|
545bb652a0 | ||
|
|
cede1db45d | ||
|
|
79393c8116 | ||
|
|
8971b19a3c | ||
|
|
7ade1d9ce0 | ||
|
|
1e242be9d5 | ||
|
|
c7e244e342 | ||
|
|
3e7fe023d8 | ||
|
|
e039c0e252 | ||
|
|
f5485d3571 | ||
|
|
fc5fb116f5 | ||
|
|
06ddbefd3c | ||
|
|
9598182e64 | ||
|
|
c5059afbc7 | ||
|
|
fb5e8d8141 | ||
|
|
d6946c7a93 | ||
|
|
355e454565 | ||
|
|
3f960f2775 | ||
|
|
a0a8401ce0 | ||
|
|
d680baffb1 | ||
|
|
eeb6fe41c8 | ||
|
|
c74ab8e815 | ||
|
|
58dedeb7d1 | ||
|
|
d00272e34f | ||
|
|
961386ff9d | ||
|
|
1a27047b5d | ||
|
|
ba3ec69bf5 | ||
|
|
76425b385e | ||
|
|
6bd2f681fa | ||
|
|
31986a91c9 | ||
|
|
211c5153ed | ||
|
|
0326d30cf1 | ||
|
|
9981906c22 | ||
|
|
c78adec4ed | ||
|
|
3b46453d48 | ||
|
|
4a17b6d4bc | ||
|
|
cae26c16a6 | ||
|
|
75da44bdb4 | ||
|
|
bfca5b534a | ||
|
|
ff0874fd35 | ||
|
|
e73b6b7205 | ||
|
|
f210caccb7 | ||
|
|
65e0951f8d | ||
|
|
45c430b523 | ||
|
|
8f54a5100e | ||
|
|
d48f3bad63 | ||
|
|
6f27c2df13 | ||
|
|
70c6de63fe | ||
|
|
6690f1d9d4 | ||
|
|
176688197f | ||
|
|
844a43f3a6 | ||
|
|
6f577abbca |
15
.github/workflows/lint.yml
vendored
Normal file
15
.github/workflows/lint.yml
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
name: Lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main, master]
|
||||
push:
|
||||
branches: [main, master]
|
||||
tags: ["v*.*.*"]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
commit:
|
||||
uses: zdharma-continuum/.github/.github/workflows/commit-job.yml@main
|
||||
lint:
|
||||
uses: zdharma-continuum/.github/.github/workflows/lint-job.yml@main
|
||||
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
feeder/**/*
|
||||
myflock/**/*
|
||||
feeder/
|
||||
myflock/
|
||||
140
README.md
140
README.md
|
|
@ -1,21 +1,133 @@
|
|||
## Introduction
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D6XDCHDSBDSDG)
|
||||
|
||||
Zconvey integrates multiple Zsh sessions. They are given an ID, optionally a NAME (both unique),
|
||||
and can send commands to each other.
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
[](https://asciinema.org/a/ayklrum7g4ut2hpt7mg6j0nzj)
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
|
||||
## Zstyles
|
||||
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
||||
|
||||
The values being set are the defaults.
|
||||
- [Introduction](#introduction)
|
||||
- [Zstyles](#zstyles)
|
||||
- [Installation](#installation)
|
||||
- [Zinit](#zinit)
|
||||
- [Antigen](#antigen)
|
||||
- [Oh-My-Zsh](#oh-my-zsh)
|
||||
- [Zgen](#zgen)
|
||||
- [Information](#information)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
# Introduction
|
||||
|
||||
Zconvey integrates multiple Zsh sessions. They are given an ID, optionally a NAME (both unique), and can send commands
|
||||
to each other. Use this to switch all your Zshells to given directory, via `zc-all cd $PWD`! Also, there's
|
||||
`zc-bg-notify` **script** (not a function), that will show notification under prompt of every active Zsh session. You
|
||||
can call this script from any program, Bash or GUI.
|
||||
|
||||
Video – view on [asciinema](https://asciinema.org/a/156726). You can resize the video by pressing `Ctrl-+` or `Cmd-+`.
|
||||
|
||||
[](https://asciinema.org/a/156726)
|
||||
|
||||
# Zstyles
|
||||
|
||||
The values being set are the defaults. They must be set before loading the plugin.
|
||||
|
||||
```zsh
|
||||
zstyle ":plugin:zconvey" check_interval "2" # How often to check if there are new commands (in seconds)
|
||||
zstyle ":plugin:zconvey" expire_seconds "20" # If shell is busy for 20 seconds, the received command will expire and not run
|
||||
zstyle ":plugin:zconvey" greeting "logo" # Display logo at Zsh start ("text" – display text, "none" – no greeting)
|
||||
zstyle ":plugin:zconvey" ask "0" # zc won't ask for missing data ("1" has the same effect as always using -a option)
|
||||
zstyle ":plugin:zconvey" ls_after_rename "0" # Don't execute zc-ls after doing rename (with zc-rename or zc-take)
|
||||
zstyle ":plugin:zconvey" use_zsystem_flock "1" # Should use faster zsystem's flock when it's possible?
|
||||
# (default true on Zsh >= 5.3)
|
||||
zstyle ":plugin:zconvey" timestamp_from "datetime" # Use zsh/datetime module for obtaining timestamp. "date" – use date command (fork)
|
||||
# How often to check if there are new commands (in seconds)
|
||||
zstyle ":plugin:zconvey" check_interval "2"
|
||||
|
||||
# If shell is busy for 22 seconds, the received command will expire and not run
|
||||
zstyle ":plugin:zconvey" expire_seconds "22"
|
||||
|
||||
# Display logo at Zsh start ("text" – display text, "none" – no greeting)
|
||||
zstyle ":plugin:zconvey" greeting "logo"
|
||||
|
||||
# zc won't ask for missing data ("1" has the same effect as always using -a
|
||||
# option)
|
||||
zstyle ":plugin:zconvey" ask "0"
|
||||
|
||||
# Don't execute zc-ls after doing rename (with zc-rename or zc-take)
|
||||
zstyle ":plugin:zconvey" ls_after_rename "0"
|
||||
|
||||
# Should use faster zsystem's flock when it's possible?
|
||||
# (default true on Zsh >= 5.3, will revert to mixed zsystem/flock on older
|
||||
# Zshells)
|
||||
zstyle ":plugin:zconvey" use_zsystem_flock "1"
|
||||
|
||||
# To put commands on command line, Zconvey can use small program "feeder". Or
|
||||
# "zsh" method, which currently doesn't automatically run the command – to use
|
||||
# when e.g. feeder doesn't build (unlikely) or when occurring any problems
|
||||
# with it
|
||||
zstyle ":plugin:zconvey" output_method "feeder"
|
||||
|
||||
# Use zsh/datetime module for obtaining timestamp. "date" – use date command
|
||||
# (fork)
|
||||
zstyle ":plugin:zconvey" timestamp_from "datetime"
|
||||
```
|
||||
|
||||
# Installation
|
||||
|
||||
**The plugin is "standalone"**, which means that only sourcing it is needed. So to install, unpack `zconvey` somewhere
|
||||
and add
|
||||
|
||||
```zsh
|
||||
source {where-zconvey-is}/zconvey.plugin.zsh
|
||||
```
|
||||
|
||||
to `zshrc`.
|
||||
|
||||
If using a plugin manager, then `Zinit` is recommended, but you can use any other too, and also install with `Oh My Zsh`
|
||||
(by copying directory to `~/.oh-my-zsh/custom/plugins`).
|
||||
|
||||
The plugin integrates with my other plugin [Zsh-Select](https://github.com/zdharma-continuum/zsh-select). Install it
|
||||
with e.g. Zinit to be able to use `-a` option for `zc` command. It also integrates with
|
||||
[marzocchi/zsh-notify](https://github.com/marzocchi/zsh-notify), via `cmds/plg-zsh-notify` script.
|
||||
|
||||
## [Zinit](https://github.com/zdharma-continuum/zinit)
|
||||
|
||||
Add `zinit load zdharma-continuum/zconvey` to your `.zshrc` file. Zinit will clone the plugin the next time you start
|
||||
zsh. To update issue `zinit update zdharma-continuum/zconvey`.
|
||||
|
||||
Zinit can load in [turbo-mode](https://github.com/zdharma-continuum/zinit#turbo-mode-zsh--53), below is an example
|
||||
configuration, together with adding `zc-bg-notify` to `$PATH`:
|
||||
|
||||
```zsh
|
||||
zinit ice wait"0"
|
||||
zinit light zdharma-continuum/zconvey
|
||||
zinit ice wait"0" as"command" pick"cmds/zc-bg-notify" silent
|
||||
zinit light zdharma-continuum/zconvey
|
||||
```
|
||||
|
||||
## Antigen
|
||||
|
||||
Add `antigen bundle zdharma-continuum/zconvey` to your `.zshrc` file. Antigen will handle cloning the plugin for you
|
||||
automatically the next time you start zsh.
|
||||
|
||||
## Oh-My-Zsh
|
||||
|
||||
1. `cd ~/.oh-my-zsh/custom/plugins`
|
||||
1. `git clone git@github.com:zdharma-continuum/zconvey.git`
|
||||
1. Add `zconvey` to your plugin list
|
||||
|
||||
## Zgen
|
||||
|
||||
Add `zgen load zdharma-continuum/zconvey` to your .zshrc file in the same place you're doing your other `zgen load`
|
||||
calls in.
|
||||
|
||||
# Information
|
||||
|
||||
There are following commands:
|
||||
|
||||
- `zc` – sends to other session; use "-a" option to be asked for target and a command to send
|
||||
- `zc-all` – the same as `zc`, but targets are all other active sessions (with `-f` also busy sessions)
|
||||
- `zc-rename` – assigns name to current or selected session; won't rename if there's a session with the same name
|
||||
- `zc-take` – takes a name for current or selected sessions, schematically renames any conflicting sessions
|
||||
- `zc-ls` – lists all active and named sessions
|
||||
- `zc-id` – shows ID and NAME of current session
|
||||
- `zc-logo` – the same as `zc-id`, but in a form of an on-screen logo; bound to Ctrl-O Ctrl-I
|
||||
- `zc-bg-notify` – in subdirectory `cmds`, link it to `/usr/local/bin`, etc. or load with e.g. Zinit
|
||||
|
||||
The main command is `zc` (yet it is rather rarely used, I'm always sending to all sessions with `zc-all`). It is used to
|
||||
execute commands on other sessions. `zc-ls` is the main tool to obtain overall information on sessions. `zc-take` is a
|
||||
nice rename tool to quickly name a few sessions. Keyboard shortcut Ctrl-O Ctrl-I will show current session's ID and NAME
|
||||
in form of an on-screen logo.
|
||||
|
|
|
|||
|
|
@ -4,11 +4,14 @@ The values being set are the defaults.
|
|||
|
||||
```zsh
|
||||
zstyle ":plugin:zconvey" check_interval "2" # How often to check if there are new commands (in seconds)
|
||||
zstyle ":plugin:zconvey" expire_seconds "20" # If shell is busy for 20 seconds, the received command will expire and not run
|
||||
zstyle ":plugin:zconvey" expire_seconds "22" # If shell is busy for 22 seconds, the received command will expire and not run
|
||||
zstyle ":plugin:zconvey" greeting "logo" # Display logo at Zsh start ("text" – display text, "none" – no greeting)
|
||||
zstyle ":plugin:zconvey" ask "0" # zc won't ask for missing data ("1" has the same effect as always using -a option)
|
||||
zstyle ":plugin:zconvey" ls_after_rename "0" # Don't execute zc-ls after doing rename (with zc-rename or zc-take)
|
||||
zstyle ":plugin:zconvey" use_zsystem_flock "1" # Should use faster zsystem's flock when it's possible?
|
||||
# (default true on Zsh >= 5.3)
|
||||
# (default true on Zsh >= 5.3, will revert to mixed zsystem/flock on older Zshells)
|
||||
zstyle ":plugin:zconvey" output_method "feeder" # To put commands on command line, Zconvey can use small program "feeder". Or "zsh"
|
||||
# method, which currently doesn't automatically run the command – to use when e.g.
|
||||
# feeder doesn't build (unlikely) or when occurring any problems with it
|
||||
zstyle ":plugin:zconvey" timestamp_from "datetime" # Use zsh/datetime module for obtaining timestamp. "date" – use date command (fork)
|
||||
```
|
||||
|
|
|
|||
16
_zc
Normal file
16
_zc
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#compdef zc
|
||||
|
||||
local arguments
|
||||
|
||||
arguments=(
|
||||
{-h,--help}'[this message]'
|
||||
{-i,--id}'[ID (number) of Zsh session]:ID'
|
||||
{-n,--name}'[NAME of Zsh session]:NAME'
|
||||
{-q,--quiet}'[dont output status messages]'
|
||||
{-v,--verbose}'[output more status messages]'
|
||||
{-a,--ask}'[ask for command (if not provided) and session (etc.)]'
|
||||
{-r,--raw}'[raw input (for scripts) - a quoted string, e.g. ls a dir]'
|
||||
'*:filename:_files'
|
||||
)
|
||||
|
||||
_arguments -s $arguments
|
||||
14
_zc-all
Normal file
14
_zc-all
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#compdef zc-all
|
||||
|
||||
local arguments
|
||||
|
||||
arguments=(
|
||||
{-h,--help}'[this message]'
|
||||
{-q,--quiet}'[dont output status messages]'
|
||||
{-v,--verbose}'[output more status messages]'
|
||||
{-a,--ask}'[ask for command (if not provided)]'
|
||||
{-f,--force}'[send also to busy sessions; command can time out]'
|
||||
'*:filename:_files'
|
||||
)
|
||||
|
||||
_arguments -s $arguments
|
||||
14
_zc-bg-notify
Normal file
14
_zc-bg-notify
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#compdef zc-bg-notify
|
||||
|
||||
local arguments
|
||||
|
||||
arguments=(
|
||||
{-h,--help}'[this message]'
|
||||
{-q,--quiet}'[dont output status messages about target sessions]'
|
||||
{-v,--verbose}'[output more status messages]'
|
||||
{-a,--ask}'[ask for notification text (if not provided)]'
|
||||
{-f,--force}'[send also to busy sessions; notification can time-out]'
|
||||
'*:filename:_files'
|
||||
)
|
||||
|
||||
_arguments -s $arguments
|
||||
13
_zc-rename
Normal file
13
_zc-rename
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#compdef zc-rename
|
||||
|
||||
local arguments
|
||||
|
||||
arguments=(
|
||||
{-h,--help}'[this message]'
|
||||
{-i,--id}'[(number) of Zsh session]:ID'
|
||||
{-n,--name}'[NAME of Zsh session]:NAME'
|
||||
{-q,--quiet}'[dont output status messages]'
|
||||
'*:filename:_files'
|
||||
)
|
||||
|
||||
_arguments -s $arguments
|
||||
13
_zc-take
Normal file
13
_zc-take
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#compdef zc-take
|
||||
|
||||
local arguments
|
||||
|
||||
arguments=(
|
||||
{-h,--help}'[this message]'
|
||||
{-i,--id}'[(number) of Zsh session]:ID'
|
||||
{-n,--name}'[NAME of Zsh session]:NAME'
|
||||
{-q,--quiet}'[dont output status messages]'
|
||||
'*:filename:_files'
|
||||
)
|
||||
|
||||
_arguments -s $arguments
|
||||
11
cmds/plg-zsh-notify
Executable file
11
cmds/plg-zsh-notify
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# For use with marzocchi/zsh-notify, by setting following zstyle in zshrc:
|
||||
# zstyle ':notify:*' notifier /path/to/zconvey/cmds/plg-zsh-notify
|
||||
|
||||
typeset -g BINDIR=${0:h}
|
||||
|
||||
local tpe="$1"
|
||||
read -t1 -r msg
|
||||
|
||||
$BINDIR/zc-bg-notify -q "$tpe - $msg"
|
||||
304
cmds/zc-bg-notify
Executable file
304
cmds/zc-bg-notify
Executable file
|
|
@ -0,0 +1,304 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
setopt localoptions extendedglob clobber
|
||||
integer idx is_locked counter=0
|
||||
local name busyfile busywith
|
||||
|
||||
#
|
||||
# Helper functions
|
||||
#
|
||||
|
||||
# FUNCTION: __zconvey_pinfo {{{
|
||||
function __zconvey_pinfo() {
|
||||
print -- "\033[0;32m$*\033[0m";
|
||||
}
|
||||
# }}}
|
||||
# FUNCTION: __zconvey_pinfo2 {{{
|
||||
function __zconvey_pinfo2() {
|
||||
print -- "\033[0;33m$*\033[0m";
|
||||
}
|
||||
# }}}
|
||||
# FUNCTION: __zconvey_get_name_of_id {{{
|
||||
function __zconvey_get_name_of_id() {
|
||||
local id="$1"
|
||||
|
||||
REPLY=""
|
||||
local f="$ZCONVEY_NAMES_DIR/${id}.name"
|
||||
if [[ -e "$f" ]]; then
|
||||
REPLY=${(f)"$(<$f)"}
|
||||
REPLY="${REPLY#:}"
|
||||
REPLY="${REPLY%:}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
# }}}
|
||||
# FUNCTION: __zconvey_is_session_active {{{
|
||||
function __zconvey_is_session_active() {
|
||||
setopt localoptions extendedglob
|
||||
local res idx="$1"
|
||||
|
||||
if [[ "$idx" != <-> || "$idx" = "0" || "$idx" -gt "100" ]]; then
|
||||
__zconvey_pinfo "Incorrect sesion ID occured: $idx"
|
||||
return 2
|
||||
fi
|
||||
|
||||
if [[ "$idx" = "$ZCONVEY_ID" ]]; then
|
||||
# Return true - current session is active
|
||||
return 0;
|
||||
fi
|
||||
|
||||
integer is_locked=0
|
||||
local idfile="$ZCONVEY_LOCKS_DIR/zsh_nr${idx}" tmpfd
|
||||
|
||||
if [[ -e "$idfile" ]]; then
|
||||
# Use zsystem only if non-blocking call is available (Zsh >= 5.3)
|
||||
if [[ "${ZCONVEY_CONFIG[use_zsystem_flock]}" = "1" ]]; then
|
||||
zsystem 2>/dev/null flock -t 0 -f tmpfd "$idfile"
|
||||
res="$?"
|
||||
else
|
||||
exec {tmpfd}>"$idfile"
|
||||
"${ZCONVEY_REPO_DIR}/myflock/flock" -nx "$tmpfd"
|
||||
res="$?"
|
||||
|
||||
# Close the fd immediately - unlocking if gained lock
|
||||
exec {tmpfd}>&-
|
||||
fi
|
||||
|
||||
if [[ "$res" = "101" || "$res" = "1" || "$res" = "2" ]]; then
|
||||
is_locked=1
|
||||
elif [[ "${ZCONVEY_CONFIG[use_zsystem_flock]}" = "1" ]]; then
|
||||
# Close the lock immediately
|
||||
zsystem flock -u "$tmpfd"
|
||||
fi
|
||||
fi
|
||||
|
||||
return $(( 1-is_locked ))
|
||||
}
|
||||
# }}}
|
||||
# FUNCTION: __zconvey_usage_zc-bg-notify {{{
|
||||
__zconvey_usage_zc-bg-notify() {
|
||||
__zconvey_pinfo2 "Sends notification to all unbusy sessions (also busy when -f passed)"
|
||||
__zconvey_pinfo "Usage: zc-bg-notify [-h|--help] [-f|--force] [-a|--ask] [-q|--quiet] [-v|--verbose] {notification-text}"
|
||||
print -- "-h/--help - this message"
|
||||
print -- "-q/--quiet - don't output status messages about target sessions"
|
||||
print -- "-v/--verbose - output more status messages"
|
||||
print -- "-a/--ask - ask for notification text (if not provided)"
|
||||
print -- "-f/--force - send also to busy sessions; notification can time-out"
|
||||
}
|
||||
# }}}
|
||||
|
||||
#
|
||||
# Send function
|
||||
#
|
||||
|
||||
# FUNCTION __zconvey_zc {{{
|
||||
function __zconvey_zc() {
|
||||
local id="$1" ntext="$2" ts
|
||||
|
||||
# Obtain current time stamp
|
||||
[[ "${+modules}" = 1 && "${modules[zsh/datetime]}" != "loaded" && "${modules[zsh/datetime]}" != "autoloaded" ]] && zmodload zsh/datetime 2>/dev/null
|
||||
(( ${+modules} == 0 )) && zmodload zsh/datetime 2>/dev/null
|
||||
(( ${+EPOCHSECONDS} )) && ts="$EPOCHSECONDS" || ts="$(date +%s )"
|
||||
|
||||
local fd datafile="${ZCONVEY_IO_DIR}/${id}.io"
|
||||
local lockfile="${datafile}.lock"
|
||||
{ echo "PID $$ is sending command" >! "$lockfile"; } 2>/dev/null
|
||||
|
||||
# 1. Zsystem lock with timeout (2 seconds)
|
||||
if (( ${ZCONVEY_CONFIG[use_zsystem_flock]} > 0 )); then
|
||||
(( ${verbose} )) && print "Will use zsystem flock..."
|
||||
if ! zsystem flock -t 2 -f fd "$lockfile"; then
|
||||
__zconvey_pinfo2 "Communication channel of session $id is busy, could not send"
|
||||
exit 1
|
||||
fi
|
||||
# 2. Provided flock binary (two calls)
|
||||
else
|
||||
(( ${verbose} )) && print "Will use provided flock..."
|
||||
exec {fd}>"$lockfile"
|
||||
"${ZCONVEY_REPO_DIR}/myflock/flock" -nx "$fd"
|
||||
if [ "$?" = "101" ]; then
|
||||
(( ${verbose} )) && print "First attempt failed, will retry..."
|
||||
LANG=C sleep 1
|
||||
"${ZCONVEY_REPO_DIR}/myflock/flock" -nx "$fd"
|
||||
if [ "$?" = "101" ]; then
|
||||
__zconvey_pinfo2 "Communication channel of session $id is busy, could not send"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# >> - multiple messages can be accumulated
|
||||
print -r -- "n$ts $ntext" >> "$datafile"
|
||||
|
||||
# Release the lock by closing the lock file
|
||||
exec {fd}>&-
|
||||
|
||||
if (( ${quiet} == 0 )); then
|
||||
__zconvey_get_name_of_id "$id"
|
||||
if [[ -n "$REPLY" ]]; then
|
||||
print "Notification sent to session $id (name: $REPLY)"
|
||||
else
|
||||
print "Notification sent to session $id"
|
||||
fi
|
||||
|
||||
integer is_locked
|
||||
__zconvey_is_session_active "$id" && is_locked=1 || is_locked=0
|
||||
(( is_locked == 0 )) && print "The session is ABSENT, the message will time out"
|
||||
fi
|
||||
}
|
||||
# }}}
|
||||
|
||||
#
|
||||
# Options
|
||||
#
|
||||
|
||||
# {{{
|
||||
|
||||
local -A opthash
|
||||
zmodload zsh/zutil
|
||||
zparseopts -D -A opthash h -help q -quiet v -verbose f -force a -ask || { __zconvey_usage_zc-bg-notify; return 1; }
|
||||
|
||||
integer verbose=0 quiet=0 force=0 ask=0
|
||||
|
||||
# Help
|
||||
(( ${+opthash[-h]} + ${+opthash[--help]} )) && { __zconvey_usage_zc-bg-notify; return 0; }
|
||||
|
||||
# ASK (requests command and/or ID)
|
||||
(( ask = ${+opthash[-a]} + ${+opthash[--ask]} ))
|
||||
if [ "$ask" = "0" ]; then
|
||||
local ask_setting
|
||||
zstyle -b ":plugin:zconvey" ask ask_setting || ask_setting="no"
|
||||
[ "$ask_setting" = "yes" ] && ask=1 || ask=0
|
||||
fi
|
||||
|
||||
# VERBOSE, QUIET, FORCE
|
||||
(( verbose = ${+opthash[-v]} + ${+opthash[--verbose]} ))
|
||||
(( quiet = ${+opthash[-q]} + ${+opthash[--quiet]} ))
|
||||
(( force = ${+opthash[-f]} + ${+opthash[--force]} ))
|
||||
|
||||
# }}}
|
||||
|
||||
#
|
||||
# Configuration
|
||||
#
|
||||
|
||||
# {{{
|
||||
|
||||
zmodload zsh/system || typeset -g no_zsystem=1
|
||||
zsystem supports flock || typeset -g no_zsystem=1
|
||||
|
||||
typeset -g ZCONVEY_REPO_DIR ZCONVEY_CONFIG_DIR ZCONVEY_IO_DIR ZCONVEY_LOCKS_DIR ZCONVEY_NAMES_DIR ZCONVEY_OTHER_DIR
|
||||
typeset -gA ZCONVEY_CONFIG
|
||||
|
||||
: ${ZCONVEY_REPO_DIR:=$HOME/.zinit/plugins/zdharma---zconvey} # TODO: add configuration file
|
||||
: ${ZCONVEY_CONFIG_DIR:=${XDG_CONFIG_HOME:-$HOME/.config}/zconvey}
|
||||
: ${ZCONVEY_IO_DIR:=${ZCONVEY_CONFIG_DIR}/io}
|
||||
: ${ZCONVEY_LOCKS_DIR:=${ZCONVEY_CONFIG_DIR}/locks}
|
||||
: ${ZCONVEY_NAMES_DIR:=${ZCONVEY_CONFIG_DIR}/names}
|
||||
: ${ZCONVEY_OTHER_DIR:=${ZCONVEY_CONFIG_DIR}/other}
|
||||
|
||||
autoload is-at-least
|
||||
|
||||
if [[ "$no_zsystem" != 1 ]]; then
|
||||
if ! is-at-least 5.3; then
|
||||
if [[ -e ${ZCONVEY_REPO_DIR}/myflock/flock ]]; then
|
||||
# Use, but not for acquire
|
||||
ZCONVEY_CONFIG[use_zsystem_flock]="2"
|
||||
else
|
||||
print "Couldn't find ${ZCONVEY_REPO_DIR}/myflock/flock, and Zsh is older than 5.3, cannot notify"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Use for all operations
|
||||
ZCONVEY_CONFIG[use_zsystem_flock]="1"
|
||||
fi
|
||||
else
|
||||
if [[ -e ${ZCONVEY_REPO_DIR}/myflock/flock ]]; then
|
||||
# Use flock for all operations
|
||||
ZCONVEY_CONFIG[use_zsystem_flock]="0"
|
||||
else
|
||||
print "Couldn't find ${ZCONVEY_REPO_DIR}/myflock/flock, and Zsh doesn't have \`zsystem flock', cannot notify"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# }}}
|
||||
|
||||
#
|
||||
# Input establishing
|
||||
#
|
||||
|
||||
# {{{
|
||||
|
||||
local -a args
|
||||
args=( "$@" )
|
||||
|
||||
local ntext="${args[*]}"
|
||||
|
||||
# Resupply missing input if requested
|
||||
if (( $ask )); then
|
||||
# Supply command?
|
||||
if [[ -z "$ntext" ]]; then
|
||||
vared -cp "Enter notification-text to send: " ntext
|
||||
ntext="${ntext##[[:space:]]#}"
|
||||
ntext="${ntext%%[[:space:]]#}"
|
||||
if [ -z "$ntext" ]; then
|
||||
__zconvey_pinfo "No command enterred, exiting"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$ntext" ]; then
|
||||
__zconvey_pinfo "No command provided, aborting"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# }}}
|
||||
|
||||
#
|
||||
# Business logic
|
||||
#
|
||||
|
||||
# {{{
|
||||
|
||||
for (( idx = 1; idx <= 100; idx ++ )); do
|
||||
name=""
|
||||
busywith=""
|
||||
is_locked=0
|
||||
|
||||
__zconvey_is_session_active "$idx" && is_locked=1 || is_locked=0
|
||||
|
||||
if (( is_locked )); then
|
||||
busyfile="$ZCONVEY_OTHER_DIR/${idx}.busy"
|
||||
if [[ -e "$busyfile" && "$idx" != "$ZCONVEY_ID" ]]; then
|
||||
busywith="\033[1;33m$(<$busyfile)\033[0m"
|
||||
|
||||
__zconvey_get_name_of_id "$idx"
|
||||
if (( force )); then
|
||||
counter+=1
|
||||
(( quiet )) || print "\033[1;35mSending to busy\033[0m session $idx (name: $REPLY, busy with: $busywith)"
|
||||
__zconvey_zc "$idx" "$ntext"
|
||||
else
|
||||
(( quiet )) || print "Session $idx (name: $REPLY) busy ($busywith)"
|
||||
fi
|
||||
elif [[ "$idx" != "$ZCONVEY_ID" ]]; then
|
||||
counter+=1
|
||||
if (( verbose )); then
|
||||
__zconvey_zc "$idx" "$ntext"
|
||||
else
|
||||
__zconvey_zc "$idx" "$ntext"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
(( quiet )) || __zconvey_pinfo "Sent command to $counter other sessions"
|
||||
|
||||
# }}}
|
||||
|
||||
return 0
|
||||
|
||||
# vim:ft=zsh
|
||||
858
doc/asciicasts/156726.json
Normal file
858
doc/asciicasts/156726.json
Normal file
|
|
@ -0,0 +1,858 @@
|
|||
{
|
||||
"version": 1,
|
||||
"width": 115,
|
||||
"height": 27,
|
||||
"duration": 50.461882,
|
||||
"command": "zsh-5.4.2-dev-0",
|
||||
"title": "Notifications for Zshell, no dbus, etc., batteries included",
|
||||
"env": {
|
||||
"TERM": "xterm-256color",
|
||||
"SHELL": "/bin/bash"
|
||||
},
|
||||
"stdout": [
|
||||
[
|
||||
0.626098,
|
||||
"\u001b[0m\u001b[27m\u001b[24m\u001b[JREADY > \u001b[K\u001b[?2004h"
|
||||
],
|
||||
[
|
||||
1.168809,
|
||||
"\r\r\n"
|
||||
],
|
||||
[
|
||||
0.000101,
|
||||
"Loaded OMZ::lib/git.zsh\r\u001b[A\u001b[0m\u001b[27m\u001b[24m\r\u001b[8C\u001b[K"
|
||||
],
|
||||
[
|
||||
0.024683,
|
||||
"\r\r\n\u001b[J"
|
||||
],
|
||||
[
|
||||
6.6e-05,
|
||||
"Loaded OMZ::plugins/git\r\u001b[A\u001b[0m\u001b[27m\u001b[24m\r\u001b[8C\u001b[K"
|
||||
],
|
||||
[
|
||||
0.042287,
|
||||
"\r\r\n\u001b[J"
|
||||
],
|
||||
[
|
||||
6.3e-05,
|
||||
"Loaded psprint/zsh-editing-workbench\r\u001b[A\u001b[0m\u001b[27m\u001b[24m\r\u001b[8C\u001b[K"
|
||||
],
|
||||
[
|
||||
0.028482,
|
||||
"\r\r\n\u001b[J"
|
||||
],
|
||||
[
|
||||
4.7e-05,
|
||||
"Loaded psprint/zsh-navigation-tools\r\u001b[A\u001b[0m\u001b[27m\u001b[24m\r\u001b[8C\u001b[K"
|
||||
],
|
||||
[
|
||||
0.078599,
|
||||
"\r\r\n\u001b[J"
|
||||
],
|
||||
[
|
||||
4.4e-05,
|
||||
"Loaded zdharma/zconvey\r\u001b[A\u001b[0m\u001b[27m\u001b[24m\r\u001b[8C\u001b[K"
|
||||
],
|
||||
[
|
||||
0.001554,
|
||||
"\r\r\n\u001b[J"
|
||||
],
|
||||
[
|
||||
6.1e-05,
|
||||
"Loaded zdharma/zconvey\r\u001b[A\u001b[0m\u001b[27m\u001b[24m\r\u001b[8C\u001b[K"
|
||||
],
|
||||
[
|
||||
0.003916,
|
||||
"\r\r\n\u001b[J"
|
||||
],
|
||||
[
|
||||
0.000375,
|
||||
"Loaded zservices/redis\r\u001b[A\u001b[0m\u001b[27m\u001b[24m\r\u001b[8C\u001b[K"
|
||||
],
|
||||
[
|
||||
0.005001,
|
||||
"\r\r\n\u001b[J"
|
||||
],
|
||||
[
|
||||
0.000244,
|
||||
"Loaded zservices/py3http\r\u001b[A\u001b[0m\u001b[27m\u001b[24m\r\u001b[8C\u001b[K"
|
||||
],
|
||||
[
|
||||
0.020314,
|
||||
"\r\r\n\u001b[J"
|
||||
],
|
||||
[
|
||||
6e-05,
|
||||
"Loaded psprint/history-search-multi-word\r\u001b[A\u001b[0m\u001b[27m\u001b[24m\r\u001b[8C\u001b[K"
|
||||
],
|
||||
[
|
||||
0.035898,
|
||||
"\r\r\n\u001b[J"
|
||||
],
|
||||
[
|
||||
5.2e-05,
|
||||
"Loaded zdharma/zui\r\u001b[A\u001b[0m\u001b[27m\u001b[24m\r\u001b[8C\u001b[K"
|
||||
],
|
||||
[
|
||||
0.497341,
|
||||
"t"
|
||||
],
|
||||
[
|
||||
0.089076,
|
||||
"\r\r\n\u001b[J"
|
||||
],
|
||||
[
|
||||
4.2e-05,
|
||||
"Loaded b4b4r07/zsh-vimode-visual\r\u001b[A\u001b[0m\u001b[27m\u001b[24m\r\u001b[8Ct\u001b[K"
|
||||
],
|
||||
[
|
||||
0.121734,
|
||||
"\r\r\n\u001b[J"
|
||||
],
|
||||
[
|
||||
4.4e-05,
|
||||
"Loaded zsh-users/zsh-autosuggestions\r\u001b[A\u001b[0m\u001b[27m\u001b[24m\r\u001b[8Ct\u001b[K"
|
||||
],
|
||||
[
|
||||
0.084719,
|
||||
"\r\r\n\u001b[J"
|
||||
],
|
||||
[
|
||||
5.3e-05,
|
||||
"Loaded zdharma/fast-syntax-highlighting\r\u001b[A\u001b[0m\u001b[27m\u001b[24m\r\u001b[8Ct\u001b[K"
|
||||
],
|
||||
[
|
||||
0.058183,
|
||||
"\b\u001b[1m\u001b[31mt\u001b[1m\u001b[31mm\u001b[0m\u001b[39m\u001b[90mux\u001b[39m\b\b"
|
||||
],
|
||||
[
|
||||
0.216846,
|
||||
"\b\b\u001b[1m\u001b[31mt\u001b[1m\u001b[31mm\u001b[1m\u001b[31mu\u001b[0m\u001b[39m"
|
||||
],
|
||||
[
|
||||
0.327563,
|
||||
"\b\b\b\u001b[0m\u001b[32mt\u001b[0m\u001b[32mm\u001b[0m\u001b[32mu\u001b[32mx\u001b[39m"
|
||||
],
|
||||
[
|
||||
0.384346,
|
||||
"\u001b[?2004l\r\r\n\u001b[J"
|
||||
],
|
||||
[
|
||||
0.101625,
|
||||
"\u001b[?1049h\u001b[?1h\u001b=\u001b[H\u001b[2J\u001b[?12l\u001b[?25h\u001b[?1000l\u001b[?1002l\u001b[?1006l\u001b[?1005l\u001b[c\u001b(B\u001b[m\u001b[?12;25h\u001b[?12l\u001b[?25h\u001b[?1003l\u001b[?1006l\u001b[?2004l\u001b[1;1H\u001b[1;27r\u001b]112\u0007\u001b[1;1H"
|
||||
],
|
||||
[
|
||||
0.001411,
|
||||
"\u001b]0;0:1:zsh-5.4.2-dev-0 - \"MacMini.local\" \u0007\u001b[?25l\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[37m\u001b[40m \u001b[42m\u001b[1m1:zsh-5.4.2-dev-0*\u001b(B\u001b[m\u001b[37m\u001b[40m 04:49P | sty. 12\u001b(B\u001b[m\u001b[1;1H\u001b[?12l\u001b[?25h"
|
||||
],
|
||||
[
|
||||
0.307662,
|
||||
"\u001b[1;26r\u001b[1;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[HREADY > \u001b[K\u001b[1;27r\u001b[1;9H\u001b[?2004h"
|
||||
],
|
||||
[
|
||||
1.019891,
|
||||
"\r\n"
|
||||
],
|
||||
[
|
||||
6.1e-05,
|
||||
"Loaded OMZ::lib/git.zsh\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.007303,
|
||||
"\u001b[1;26r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1;27r\u001b[2;1HLoaded OMZ::plugins/git\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.00478,
|
||||
"\u001b[1;26r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1;27r\u001b[2;1HLoaded psprint/zsh-editing-workbench\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.00702,
|
||||
"\u001b[1;26r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1;27r\u001b[2;1HLoaded psprint/zsh-navigation-tools\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.02073,
|
||||
"\u001b[1;26r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1;27r\u001b[2;1HLoaded zdharma/zconvey\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.001025,
|
||||
"\u001b[1;26r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1;27r\u001b[2;1H"
|
||||
],
|
||||
[
|
||||
4.6e-05,
|
||||
"Loaded zdharma/zconvey\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.002882,
|
||||
"\u001b[1;26r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1;27r\u001b[2;1H"
|
||||
],
|
||||
[
|
||||
4.7e-05,
|
||||
"Loaded zservices/redis\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.003902,
|
||||
"\u001b[1;26r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1;27r\u001b[2;1HLoaded zservices/py3http"
|
||||
],
|
||||
[
|
||||
5.2e-05,
|
||||
"\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.0043,
|
||||
"\u001b[1;26r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1;27r\u001b[2;1HLoaded psprint/history-search-multi-word\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.00786,
|
||||
"\u001b[1;26r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1;27r\u001b[2;1H"
|
||||
],
|
||||
[
|
||||
4.9e-05,
|
||||
"Loaded zdharma/zui\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.589243,
|
||||
"\u001b[?25l\u001b[14;1H──────────────────────────────────────────────────────────\u001b[32m─────────────────────────────────────────────────────────\u001b[1;1H\u001b(B\u001b[mREADY > \u001b[K\r\nLoaded zdharma/zui \u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\u001b[2B\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[37m\u001b[40m \u001b[42m\u001b[1m1:zsh-5.4.2-dev-0*\u001b(B\u001b[m\u001b[37m\u001b[40m 04:49P | sty. 12\u001b(B\u001b[m\u001b[15;1H\u001b[?12l\u001b[?25h\u001b[?2004l"
|
||||
],
|
||||
[
|
||||
0.000269,
|
||||
"\u001b[1;13r\u001b[1;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[HREADY > \u001b[1;27r\u001b[15;1H"
|
||||
],
|
||||
[
|
||||
0.303573,
|
||||
"\u001b[15;26r\u001b[15;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[15dREADY > \u001b[K\u001b[1;27r\u001b[15;9H\u001b[?2004h"
|
||||
],
|
||||
[
|
||||
0.764524,
|
||||
"\u001b[2;1HLoaded b4b4r07/zsh-vimode-visual\u001b[1;9H\u001b[K\u001b[15d"
|
||||
],
|
||||
[
|
||||
0.051627,
|
||||
"\u001b[?25l\u001b[14;1H─────────────────────────────────────────────────────────\u001b[32m┬─────────────────────────────────────────────────────────\u001b[15;58H│\u001b[16;58H│\u001b[17;58H│\u001b[18;58H│\u001b[19;58H│\u001b[20;58H│\u001b[21;58H│\u001b[22;58H│\u001b[23;58H│\u001b[24;58H│\u001b[25;58H│\u001b[26;58H│\u001b[H\u001b(B\u001b[mREADY > \u001b[K\r\nLoaded b4b4r07/zsh-vimode-visual \u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\u001b[15;57H\u001b[1K\rREADY > \u001b[16;57H\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\u001b[15;59H\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\r\n\u001b[37m\u001b[40m \u001b[42m\u001b[1m1:zsh-5.4.2-dev-0*\u001b(B\u001b[m\u001b[37m\u001b[40m 04:49P | sty. 12\u001b(B\u001b[m\u001b[15;59H\u001b[?12l\u001b[?25h\u001b[?2004l"
|
||||
],
|
||||
[
|
||||
0.001719,
|
||||
"\u001b]0;0:1:tmux - \"MacMini.local\" \u0007\u001b[?25l\u001b[27;1H\u001b[37m\u001b[40m \u001b[42m\u001b[1m1:tmux*\u001b(B\u001b[m\u001b[37m\u001b[40m 04:49P | sty. 12\u001b(B\u001b[m\u001b[15;59H\u001b[?12l\u001b[?25h\u001b[15;26r\u001b[15;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[15;1HREADY > "
|
||||
],
|
||||
[
|
||||
5.8e-05,
|
||||
"\u001b[1;27r\u001b[15;59H"
|
||||
],
|
||||
[
|
||||
0.051877,
|
||||
"\u001b[1;13r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1;27r\u001b[15;59H"
|
||||
],
|
||||
[
|
||||
5e-05,
|
||||
"\u001b[2;1HLoaded zsh-users/zsh-autosuggestions\u001b[15;59H"
|
||||
],
|
||||
[
|
||||
0.050697,
|
||||
"\u001b[1;13r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1;27r\u001b[15;59H"
|
||||
],
|
||||
[
|
||||
4.7e-05,
|
||||
"\u001b[2;1HLoaded zdharma/fast-syntax-highlighting\u001b[15;59H"
|
||||
],
|
||||
[
|
||||
0.23615,
|
||||
"\u001b[15;26r\u001b[15;59H \u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[15;59HREADY > \u001b[15;1H\u001b[1;27r\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
4.6e-05,
|
||||
"\u001b[?2004h"
|
||||
],
|
||||
[
|
||||
0.659458,
|
||||
"\u001b]0;0:1:zsh-5.4.2-dev-0 - \"MacMini.local\" \u0007\u001b[?25l\u001b[27;1H\u001b[37m\u001b[40m \u001b[42m\u001b[1m1:zsh-5.4.2-dev-0*\u001b(B\u001b[m\u001b[37m\u001b[40m 04:49P | sty. 12\u001b(B\u001b[m\u001b[15;67H\u001b[?12l\u001b[?25h"
|
||||
],
|
||||
[
|
||||
0.019563,
|
||||
"\r\nLoaded OMZ::lib/git.zsh\u001b[15;9H \u001b[9C"
|
||||
],
|
||||
[
|
||||
0.005679,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
4.8e-05,
|
||||
"\r\nLoaded OMZ::plugins/git\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
0.004594,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
4.3e-05,
|
||||
"\r\nLoaded psprint/zsh-editing-workbench\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
0.004885,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[15;67H\r\nLoaded psprint/zsh-navigation-tools"
|
||||
],
|
||||
[
|
||||
3.9e-05,
|
||||
"\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
0.02325,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
6e-05,
|
||||
"\r\nLoaded zdharma/zconvey\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
0.001326,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[15;67H\r\nLoaded zdharma/zconvey"
|
||||
],
|
||||
[
|
||||
4.6e-05,
|
||||
"\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
0.003777,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[15;67H\r\nLoaded zservices/redis"
|
||||
],
|
||||
[
|
||||
0.00036,
|
||||
"\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
0.003691,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
0.000229,
|
||||
"\r\nLoaded zservices/py3http\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
0.003908,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[15;67H\r\nLoaded psprint/history-search-multi-word"
|
||||
],
|
||||
[
|
||||
4.3e-05,
|
||||
"\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
0.010095,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
4.7e-05,
|
||||
"\r\nLoaded zdharma/zui\u001b[15;67H"
|
||||
],
|
||||
[
|
||||
0.254767,
|
||||
"\u001b[?25l\u001b[32m\u001b[14;1H─────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────\u001b[39m\u001b[15;58H│\u001b[16;58H│\u001b[17;58H│\u001b[18;58H│\u001b[19;58H│\u001b[20;58H│\u001b[21;58H│\u001b[22;58H│\u001b[23;58H│\u001b[24;58H│\u001b[25;58H│\u001b[26;58H│\u001b(B\u001b[m\u001b[1;9H\u001b[?12l\u001b[?25h"
|
||||
],
|
||||
[
|
||||
0.02438,
|
||||
"\u001b[16;59HLoaded OMZ::lib/git.zsh\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.005976,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
4.9e-05,
|
||||
"\u001b[16;59HLoaded OMZ::plugins/git\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.004685,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
4.5e-05,
|
||||
"\u001b[16;59HLoaded psprint/zsh-editing-workbench\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.007131,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
6.1e-05,
|
||||
"\u001b[16;59HLoaded psprint/zsh-navigation-tools\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.025176,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
5.3e-05,
|
||||
"\u001b[16;59HLoaded zdharma/zconvey\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.000946,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
4.8e-05,
|
||||
"\u001b[16;59HLoaded zdharma/zconvey\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.003046,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[1;9H\u001b[16;59HLoaded zservices/redis"
|
||||
],
|
||||
[
|
||||
0.000118,
|
||||
"\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.003187,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
5.1e-05,
|
||||
"\u001b[16;59HLoaded zservices/py3http\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.003496,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[1;9H\u001b[16;59HLoaded psprint/history-search-multi-word"
|
||||
],
|
||||
[
|
||||
5e-05,
|
||||
"\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.00757,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
4.9e-05,
|
||||
"\u001b[16;59HLoaded zdharma/zui\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.727548,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
4.8e-05,
|
||||
"\u001b[16;1HLoaded b4b4r07/zsh-vimode-visual\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.094027,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[1;9H\u001b[16;1HLoaded zsh-users/zsh-autosuggestions"
|
||||
],
|
||||
[
|
||||
7.2e-05,
|
||||
"\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.046145,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
5e-05,
|
||||
"\u001b[16;1HLoaded zdharma/fast-syntax-highlighting\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.227412,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
5.2e-05,
|
||||
"\u001b[16;59HLoaded b4b4r07/zsh-vimode-visual\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.099524,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
5.8e-05,
|
||||
"\u001b[16;59HLoaded zsh-users/zsh-autosuggestions\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.047877,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
6.6e-05,
|
||||
"\u001b[16;59HLoaded zdharma/fast-syntax-highlighting\u001b[1;9H"
|
||||
],
|
||||
[
|
||||
0.336777,
|
||||
"\u001b[31m\u001b[1mz\u001b(B\u001b[m\u001b[90mplg load marzocchi/zsh-notify\u001b[10G\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.353158,
|
||||
"\b\u001b[32mzc\u001b[90m-bg-notify -q Hello, this is a notification \":)\"\u001b[11G\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.171715,
|
||||
"\b\b\u001b[31m\u001b[1mzc-\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.392888,
|
||||
"\b\u001b[31m\u001b[1m-a\u001b(B\u001b[m\u001b[90mll -q MYPROMPT=1; MYPROMPT=1\u001b[39m \u001b[13G"
|
||||
],
|
||||
[
|
||||
0.447268,
|
||||
"\b\u001b[31m\u001b[1mal\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.176337,
|
||||
"\u001b[5D\u001b[32mzc-all\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.513202,
|
||||
" \u001b[36m-q\u001b[39m MYPROMPT=1; MYPROMPT=1"
|
||||
],
|
||||
[
|
||||
2.001485,
|
||||
"\u001b[1;13r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1;27r\u001b[2;1H\u001b[?2004l"
|
||||
],
|
||||
[
|
||||
0.329241,
|
||||
"\u001b[1;13r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[2d\u001b[33m\u001b[1m16:50\u001b[31m[\u001b(B\u001b[m\u001b[36m/Users/sgniazdowski\u001b[31m\u001b[1m]\u001b[33m2\u001b[32m >: \u001b(B\u001b[m\u001b[K\u001b[1;27r\u001b[2;32H\u001b[?2004h"
|
||||
],
|
||||
[
|
||||
0.34192,
|
||||
"\u001b[15;67HM\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001778,
|
||||
"\u001b[15;67HMY\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001328,
|
||||
"\u001b[15;69HP\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001243,
|
||||
"\u001b[15;70HR\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001068,
|
||||
"\u001b[15;71HO\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.000939,
|
||||
"\u001b[15;72HM\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.000888,
|
||||
"\u001b[15;73HP\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001175,
|
||||
"\u001b[15;74HT\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001819,
|
||||
"\u001b[15;75H=\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.000907,
|
||||
"\u001b[15;76H1\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001442,
|
||||
"\u001b[15;77H \u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001262,
|
||||
"\u001b[15;78H#\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001232,
|
||||
"\u001b[15;79H#\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.005286,
|
||||
"\u001b[15;78H\u001b[30m\u001b[1m##\u001b[2;32H\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.001708,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.098855,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[16;59HREADY > \u001b[16;1H\u001b[1;27r\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.497609,
|
||||
"\u001b[15;9HM\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.000927,
|
||||
"\u001b[15;9HMY\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.000844,
|
||||
"\u001b[15;11HP\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.000851,
|
||||
"\u001b[15;12HR\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.000916,
|
||||
"\u001b[15;13HO\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.00082,
|
||||
"\u001b[15;14HM\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.000888,
|
||||
"\u001b[15;15HP\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.000815,
|
||||
"\u001b[15;16HT\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001318,
|
||||
"\u001b[15;17H=\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.000922,
|
||||
"\u001b[15;18H1\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001276,
|
||||
"\u001b[15;19H \u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001444,
|
||||
"\u001b[15;20H#\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001247,
|
||||
"\u001b[15;21H#\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.005696,
|
||||
"\u001b[15;20H\u001b[30m\u001b[1m##\u001b[2;32H\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.001201,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.089655,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[16;1HREADY > \u001b[1;27r\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.409803,
|
||||
"\u001b[17;59HLoaded psprint/zprompts\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001048,
|
||||
"\u001b[15;26r\u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[16;59H\u001b[33m\u001b[1m16:50\u001b[31m[\u001b(B\u001b[m\u001b[36m/Users/sgniazdowski\u001b[31m\u001b[1m]\u001b[33m30\u001b[32m >: \u001b(B\u001b[m \u001b[16;1H\u001b[1;27r\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.608715,
|
||||
"\u001b[17;1HLoaded psprint/zprompts\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
0.001406,
|
||||
"\u001b[15;26r\u001b[16;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[16;1H\u001b[33m\u001b[1m16:50\u001b[31m[\u001b(B\u001b[m\u001b[36m/Users/sgniazdowski\u001b[31m\u001b[1m]\u001b[33m30\u001b[32m >: \u001b(B\u001b[m \u001b[1;27r\u001b[2;32H"
|
||||
],
|
||||
[
|
||||
1.946601,
|
||||
"\u001b[31m\u001b[1mz\u001b(B\u001b[m\u001b[90mc-all -q MYPROMPT=1; MYPROMPT=1\u001b[31D\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.252061,
|
||||
"\b\u001b[32mzc\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.168607,
|
||||
"\b\b\u001b[31m\u001b[1mzc-\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.222523,
|
||||
"\b\u001b[31m\u001b[1m-b\u001b(B\u001b[m\u001b[90mg-notify -q Hello, this is a notification \":)\"\u001b[36G\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.231058,
|
||||
"\b\u001b[31m\u001b[1mbg\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
1.07916,
|
||||
"\u001b[5D\u001b[32mzc-bg-notify\u001b[39m \u001b[36m-q\u001b[39m Hello, this is \u001b[35ma\u001b[39m notification \u001b[33m\":)\"\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
2.104492,
|
||||
"\r\n\u001b[?2004l"
|
||||
],
|
||||
[
|
||||
0.432261,
|
||||
"\u001b[17;59HNotification: Hello, this is a notification :)\u001b[3;1H"
|
||||
],
|
||||
[
|
||||
0.043479,
|
||||
"\u001b[1;13r\u001b[3;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[3d\u001b[33m\u001b[1m16:50\u001b[31m[\u001b(B\u001b[m\u001b[36m/Users/sgniazdowski\u001b[31m\u001b[1m]\u001b[33m3\u001b[32m >: \u001b(B\u001b[m\u001b[K\u001b[1;27r\u001b[3;32H\u001b[?2004h"
|
||||
],
|
||||
[
|
||||
0.572582,
|
||||
"\u001b[17;1HNotification: Hello, this is a notification :)\u001b[3;32H"
|
||||
],
|
||||
[
|
||||
3.212131,
|
||||
"\u001b[31m\u001b[1mz\u001b(B\u001b[m\u001b[90mc-bg-notify -q Hello, this is a notification \":)\"\u001b[33G\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.24654,
|
||||
"\b\u001b[31m\u001b[1mzp\u001b(B\u001b[m\u001b[90mlg load marzocchi/zsh-notify\u001b[39m \u001b[34G"
|
||||
],
|
||||
[
|
||||
0.091053,
|
||||
"\b\b\u001b[32mzpl\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.225038,
|
||||
"\b\u001b[32mlg\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.205787,
|
||||
" "
|
||||
],
|
||||
[
|
||||
0.198544,
|
||||
"l"
|
||||
],
|
||||
[
|
||||
0.176307,
|
||||
"o"
|
||||
],
|
||||
[
|
||||
0.128904,
|
||||
"a"
|
||||
],
|
||||
[
|
||||
0.921396,
|
||||
"d marzocchi/zsh-notify"
|
||||
],
|
||||
[
|
||||
1.416939,
|
||||
"\r\n\u001b[?2004l"
|
||||
],
|
||||
[
|
||||
0.206711,
|
||||
"\u001b[1;13r\u001b[4;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[4d\u001b[33m\u001b[1m16:50\u001b[31m[\u001b(B\u001b[m\u001b[36m/Users/sgniazdowski\u001b[31m\u001b[1m]\u001b[33m4\u001b[32m >: \u001b(B\u001b[m\u001b[K\u001b[1;27r\u001b[4;32H\u001b[?2004h"
|
||||
],
|
||||
[
|
||||
1.813306,
|
||||
"\u001b[31m\u001b[1ms\u001b(B\u001b[m\u001b[90mleep 4\u001b[6D\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.160502,
|
||||
"\b\u001b[31m\u001b[1msl\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.141742,
|
||||
"\b\b\u001b[31m\u001b[1msle\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.163424,
|
||||
"\b\u001b[31m\u001b[1mee\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.110292,
|
||||
"\u001b[4D\u001b[32msleep\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.666823,
|
||||
" 4"
|
||||
],
|
||||
[
|
||||
1.410221,
|
||||
"\r\n\u001b[?2004l"
|
||||
],
|
||||
[
|
||||
0.738788,
|
||||
"\u001b[?25l\u001b[27d\u001b[37m\u001b[40m \u001b[42m\u001b[1m1:zsh-5.4.2-dev-0*\u001b(B\u001b[m\u001b[37m\u001b[40m 04:50P | sty. 12\u001b(B\u001b[m\u001b[5;1H\u001b[?12l\u001b[?25h"
|
||||
],
|
||||
[
|
||||
0.337715,
|
||||
"\u001b[?25l\u001b[9B─────────────────────────────────────────────────────────\u001b[32m┬─────────────────────────────────────────────────────────\u001b[15;58H│\u001b[16;58H│\u001b[17;58H│\u001b[18;58H│\u001b[19;58H│\u001b[20;58H│\u001b[21;58H│\u001b[22;58H│\u001b[23;58H│\u001b[24;58H│\u001b[25;58H│\u001b[26;58H│\u001b(B\u001b[m\u001b[16;91H\u001b[?12l\u001b[?25h\u001b[?2004h"
|
||||
],
|
||||
[
|
||||
3.081547,
|
||||
"\u001b[1;13r\u001b[5;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[5d\u001b[33m\u001b[1m16:50\u001b[31m[\u001b(B\u001b[m\u001b[36m/Users/sgniazdowski\u001b[31m\u001b[1m]\u001b[33m5\u001b[32m >: \u001b(B\u001b[m\u001b[K\u001b[1;27r\u001b[16;91H"
|
||||
],
|
||||
[
|
||||
1.894473,
|
||||
"\u001b[15;26r\u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H \u001b[26;59H \u001b[26;1H\u001b[1;27r\u001b[17;59H"
|
||||
],
|
||||
[
|
||||
5.3e-05,
|
||||
"Notification: success - sleep 4\u001b[16;91H"
|
||||
],
|
||||
[
|
||||
0.574054,
|
||||
"\u001b[15;26r\u001b[17;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[1;27r\u001b[16;91H"
|
||||
],
|
||||
[
|
||||
0.000113,
|
||||
"\r\nNotification: success - sleep 4\u001b[16;91H"
|
||||
],
|
||||
[
|
||||
3.057596,
|
||||
"\u001b[?25l\u001b[32m\u001b[14;1H─────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────\u001b[39m\u001b[15;58H│\u001b[16;58H│\u001b[17;58H│\u001b[18;58H│\u001b[19;58H│\u001b[20;58H│\u001b[21;58H│\u001b[22;58H│\u001b[23;58H│\u001b[24;58H│\u001b[25;58H│\u001b[26;58H│\u001b(B\u001b[m\u001b[5;32H\u001b[?12l\u001b[?25h"
|
||||
],
|
||||
[
|
||||
0.855259,
|
||||
"\r\n\u001b[?2004l"
|
||||
],
|
||||
[
|
||||
0.796476,
|
||||
"\u001b[?25l\u001b[1;58H│\u001b[2;58H│\u001b[3;58H│\u001b[4;58H│\u001b[5;58H│\u001b[6;58H│\u001b[7;58H│\u001b[8;58H│\u001b[9;58H│\u001b[10;58H│\u001b[11;58H│\u001b[12;58H│\u001b[13;58H│\u001b[14;58H│\u001b[32m\u001b[15;58H│\u001b[16;58H│\u001b[17;58H│\u001b[18;58H│\u001b[19;58H│\u001b[20;58H│\u001b[21;58H│\u001b[22;58H│\u001b[23;58H│\u001b[24;58H│\u001b[25;58H│\u001b[26;58H│\u001b(B\u001b[m\u001b[1;57H\u001b[1K\u001b[HREADY > MYPROMPT=1 \u001b[30m\u001b[1m##\u001b(B\u001b[m \u001b[2;57H\u001b[1K\r\u001b[33m\u001b[1m16:50\u001b[31m[\u001b(B\u001b[m\u001b[36m/Users/sgniazdowski\u001b[31m\u001b[1m]\u001b[33m30\u001b[32m >: \r\n\u001b(B\u001b[mNotification: success - sleep 4 \u001b[4;57H\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\n\u001b[1K\u001b[1;59HREADY > MYPROMPT=1 \u001b[30m\u001b[1m##\u001b(B\u001b[m \u001b[K\u001b[2;59H\u001b[33m\u001b[1m16:50\u001b[31m[\u001b(B\u001b[m\u001b[36m/Users/sgniazdowski\u001b[31m\u001b[1m]\u001b[33m30\u001b[32m >: \u001b(B\u001b[m\u001b[K\u001b[3;59HNotification: success - sleep 4 \u001b[3;115H\u001b[4;59H\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\n\u001b[K\r\n\u001b[37m\u001b[40m "
|
||||
],
|
||||
[
|
||||
0.000151,
|
||||
" \u001b[42m\u001b[1m1:zsh-5.4.2-dev-0*\u001b(B\u001b[m\u001b[37m\u001b[40m 04:50P | sty. 12\u001b(B\u001b[m\u001b[2;91H\u001b[?12l\u001b[?25h\u001b[?2004h"
|
||||
],
|
||||
[
|
||||
0.000322,
|
||||
"\u001b[1;26r\u001b[2;1H \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n "
|
||||
],
|
||||
[
|
||||
0.000142,
|
||||
" \r\n \r\n \r\n \r\n \r\n \r\n \r\n \u001b[2;1H\u001b[33m\u001b[1m16:50\u001b[31m[\u001b(B\u001b[m\u001b[36m/Users/sgniazdowski\u001b[31m\u001b[1m]\u001b[33m2\u001b[32m >: \u001b(B\u001b[m\u001b[27C \u001b[3;59H \u001b[4;59H \u001b[5;59H \u001b[6;59H \u001b[7;59H \u001b[8;59H \u001b[9;59H "
|
||||
],
|
||||
[
|
||||
0.000136,
|
||||
" \u001b[10;59H \u001b[11;59H \u001b[12;59H \u001b[13;59H \u001b[14;59H \u001b[15;59H \u001b[16;59H \u001b[17;59H \u001b[18;59H \u001b[19;59H \u001b[20;59H \u001b[21;59H \u001b[22;59H \u001b[23;59H \u001b[24;59H \u001b[25;59H "
|
||||
],
|
||||
[
|
||||
4.6e-05,
|
||||
" \u001b[26;59H \u001b[2;59H\u001b[33m\u001b[1m16:50\u001b[31m[\u001b(B\u001b[m\u001b[36m/Users/sgniazdowski\u001b[31m\u001b[1m]\u001b[33m2\u001b[32m >: \u001b[1;27r\u001b[2;90H\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.450586,
|
||||
"\u001b[3;59H\u001b[?2004l"
|
||||
],
|
||||
[
|
||||
0.777972,
|
||||
"\u001b[?25l\u001b[HREADY > MYPROMPT=1 \u001b[30m\u001b[1m##\u001b(B\u001b[m \u001b[K\r\n\u001b[33m\u001b[1m16:50\u001b[31m[\u001b(B\u001b[m\u001b[36m/Users/sgniazdowski\u001b[31m\u001b[1m]\u001b[33m2\u001b[32m >: \u001b(B\u001b[m \u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[37m\u001b[40m \u001b[42m\u001b[1m1:zsh-5.4.2-dev-0*\u001b(B\u001b[m\u001b[37m\u001b[40m 04:50P | sty. 12\u001b(B\u001b[m\u001b[2;32H\u001b[?12l\u001b[?25h\u001b[?2004h"
|
||||
],
|
||||
[
|
||||
0.00025,
|
||||
"\u001b[1;26r\u001b[2;1H\u001b[K\r\n\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[1B\u001b[K\u001b[2d\u001b[33m\u001b[1m16:50\u001b[31m[\u001b(B\u001b[m\u001b[36m/Users/sgniazdowski\u001b[31m\u001b[1m]\u001b[33m2\u001b[32m >: \u001b[1;27r\u001b[2;32H\u001b(B\u001b[m"
|
||||
],
|
||||
[
|
||||
0.373956,
|
||||
"\r\n\u001b[?2004l"
|
||||
],
|
||||
[
|
||||
0.782026,
|
||||
"\u001b[1;27r\u001b(B\u001b[m\u001b[?1l\u001b>\u001b[H\u001b[2J\u001b]112\u0007\u001b[?12l\u001b[?25h\u001b[?1000l\u001b[?1002l\u001b[?1006l\u001b[?1005l\u001b[?1049l"
|
||||
],
|
||||
[
|
||||
0.000196,
|
||||
"[exited]\r\n"
|
||||
],
|
||||
[
|
||||
0.084071,
|
||||
"\u001b[0m\u001b[27m\u001b[24m\u001b[JREADY > \u001b[K\u001b[?2004h"
|
||||
],
|
||||
[
|
||||
0.836974,
|
||||
"\u001b[?2004l\r\r\n"
|
||||
]
|
||||
]
|
||||
}
|
||||
1502
doc/asciicasts/208206.cast
Normal file
1502
doc/asciicasts/208206.cast
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -5,7 +5,7 @@
|
|||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#ifndef TIOCSTI
|
||||
#define TIOCSTI 0x5412
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -210,8 +210,10 @@ static inline __attribute__((const)) int is_power_of_2(unsigned long num)
|
|||
}
|
||||
|
||||
#ifndef HAVE_LOFF_T
|
||||
#ifndef __CYGWIN__
|
||||
typedef int64_t loff_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_DIRFD) && (!defined(HAVE_DECL_DIRFD) || HAVE_DECL_DIRFD == 0) && defined(HAVE_DIR_DD_FD)
|
||||
#include <sys/types.h>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
=== THE SAME SHELL - THE SAME BEHAVIOR ===
|
||||
==========================================
|
||||
|
||||
Original flock had behavior:~
|
||||
Flock has behavior:~
|
||||
|
||||
% exec {MY}<test.txt
|
||||
% ~/github/zconvey.git/myflock/flock -nx "${MY}" ; echo $?
|
||||
|
|
@ -21,7 +21,7 @@ Zsh has behavior:~
|
|||
=== NEW SUBSHELL - THE SAME BEHAVIOR ===
|
||||
========================================
|
||||
|
||||
Original flock had behavior:~
|
||||
Flock has behavior:~
|
||||
|
||||
% exec {MY}<test.txt
|
||||
% ~/github/zconvey.git/myflock/flock -nx "${MY}" ; echo $?
|
||||
|
|
@ -43,7 +43,7 @@ Zsh has behavior:~
|
|||
=== EXEC ZSH - DIFFERENT BEHAVIOR ===
|
||||
=====================================
|
||||
|
||||
Original flock had behavior:
|
||||
Flock has behavior:
|
||||
|
||||
% exec {MY}<test.txt
|
||||
% ~/github/zconvey.git/myflock/flock -nx "${MY}" ; echo $?
|
||||
|
|
|
|||
198
zc
Normal file
198
zc
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
setopt localoptions extendedglob clobber
|
||||
|
||||
function __zconvey_usage_zc() {
|
||||
__zconvey_pinfo2 "Sends specified commands to given (via ID or NAME) Zsh session"
|
||||
__zconvey_pinfo "Usage: zc {-i ID}|{-n NAME} [-q|--quiet] [-v|--verbose] [-h|--help] [-a|--ask] [-r|--raw] COMMAND ARGUMENT ..."
|
||||
print -- "-h/--help - this message"
|
||||
print -- "-i ID / --id ID - ID (number) of Zsh session"
|
||||
print -- "-n NAME / --name NAME - NAME of Zsh session"
|
||||
print -- "-q/--quiet - don't output status messages"
|
||||
print -- "-v/--verbose - output more status messages"
|
||||
print -- "-a/--ask - ask for command (if not provided) and session (etc.)"
|
||||
print -r -- "-r/--raw - raw input (for scripts) - a quoted string, e.g. ls \\'a\\ dir\\'"
|
||||
}
|
||||
|
||||
local -A opthash
|
||||
zparseopts -D -A opthash h -help q -quiet v -verbose i: -id: n: -name: a -ask r -raw || { __zconvey_usage_zc; return 1; }
|
||||
|
||||
integer have_id=0 have_name=0 verbose=0 quiet=0 ask=0 raw=0
|
||||
local id name
|
||||
|
||||
# Help
|
||||
(( ${+opthash[-h]} + ${+opthash[--help]} )) && { __zconvey_usage_zc; return 0; }
|
||||
|
||||
# ID
|
||||
have_id=$(( ${+opthash[-i]} + ${+opthash[--id]} ))
|
||||
(( ${+opthash[-i]} )) && id="${opthash[-i]}"
|
||||
(( ${+opthash[--id]} )) && id="${opthash[--id]}"
|
||||
|
||||
# NAME
|
||||
have_name=$(( ${+opthash[-n]} + ${+opthash[--name]} ))
|
||||
(( ${+opthash[-n]} )) && name="${opthash[-n]}"
|
||||
(( ${+opthash[--name]} )) && name="${opthash[--name]}"
|
||||
|
||||
# ASK (requests command and/or ID)
|
||||
(( ask = ${+opthash[-a]} + ${+opthash[--ask]} ))
|
||||
if [ "$ask" = "0" ]; then
|
||||
local ask_setting
|
||||
zstyle -b ":plugin:zconvey" ask ask_setting || ask_setting="no"
|
||||
[ "$ask_setting" = "yes" ] && ask=1 || ask=0
|
||||
fi
|
||||
|
||||
# VERBOSE, QUIET, RAW
|
||||
(( verbose = ${+opthash[-v]} + ${+opthash[--verbose]} ))
|
||||
(( quiet = ${+opthash[-q]} + ${+opthash[--quiet]} ))
|
||||
(( raw = ${+opthash[-r]} + ${+opthash[--raw]} ))
|
||||
|
||||
if [[ "$have_id" != "0" && "$have_name" != "0" ]]; then
|
||||
__zconvey_pinfo "Please supply only one of ID (-i) and NAME (-n)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$have_id" != "0" && "$id" != <-> ]]; then
|
||||
__zconvey_pinfo "ID must be numeric, 1..100"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local cmd
|
||||
if (( raw )); then
|
||||
cmd="${*}"
|
||||
else
|
||||
local -a args
|
||||
args=( "${(q)@}" )
|
||||
|
||||
cmd="${args[*]}"
|
||||
cmd="${cmd//\\;/;}"
|
||||
cmd="${cmd//\\|/|}"
|
||||
cmd="${cmd//\\&/&}"
|
||||
cmd="${cmd##[[:space:]]#}"
|
||||
cmd="${cmd%%[[:space:]]#}"
|
||||
fi
|
||||
|
||||
if [[ -z "$cmd" && "$ask" = "0" ]]; then
|
||||
__zconvey_usage_zc
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$have_id" = "0" && "$have_name" = "0" && "$ask" = "0" ]]; then
|
||||
__zconvey_pinfo "Either supply target ID/NAME or request Zsh-Select (-a/--ask)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Resolve name
|
||||
if (( $have_name )); then
|
||||
__zconvey_resolve_name_to_id "$name"
|
||||
local resolved="$REPLY"
|
||||
if [ -z "$resolved" ]; then
|
||||
echo "Could not find session named: \`$name'"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Store the resolved ID and continue normally,
|
||||
# with ID as the main specifier of session
|
||||
id="$resolved"
|
||||
fi
|
||||
|
||||
# Resupply missing input if requested
|
||||
if (( $ask )); then
|
||||
# Supply command?
|
||||
if [[ -z "$cmd" ]]; then
|
||||
vared -cp "Enter command to send: " cmd
|
||||
cmd="${cmd##[[:space:]]#}"
|
||||
cmd="${cmd%%[[:space:]]#}"
|
||||
if [ -z "$cmd" ]; then
|
||||
__zconvey_pinfo "No command enterred, exiting"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Supply session?
|
||||
if [[ "$have_id" = "0" && "$have_name" = "0" ]]; then
|
||||
if ! type zsh-select 2>/dev/null 1>&2; then
|
||||
__zconvey_pinfo "Zsh-Select not installed, please install it before using -a/--ask, aborting"
|
||||
__zconvey_pinfo "Example installation: zinit load psprint/zsh-select"
|
||||
return 1
|
||||
else
|
||||
export ZSHSELECT_START_IN_SEARCH_MODE=0
|
||||
id=`zc-ls | zsh-select`
|
||||
if [ -z "$id" ]; then
|
||||
__zconvey_pinfo "No selection, exiting"
|
||||
return 0
|
||||
else
|
||||
id="${id//(#b)*ID: ([[:digit:]]#)[^[:digit:]]#*(#e)/$match[1]}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$cmd" ]; then
|
||||
__zconvey_pinfo "No command provided, aborting"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$id" != <-> || "$id" = "0" || "$id" -gt "100" ]]; then
|
||||
__zconvey_pinfo "Incorrect sesion ID occured: \`$idx'. ID should be in range 1..100"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Obtain current time stamp
|
||||
local ts
|
||||
if [ "$ZCONVEY_CONFIG[timestamp_from]" = "datetime" ]; then
|
||||
[[ "${+modules}" = 1 && "${modules[zsh/datetime]}" != "loaded" && "${modules[zsh/datetime]}" != "autoloaded" ]] && zmodload zsh/datetime
|
||||
[ "${+modules}" = 0 ] && zmodload zsh/datetime
|
||||
ts="$EPOCHSECONDS"
|
||||
fi
|
||||
# Also a fallback
|
||||
if [[ "$ZCONVEY_CONFIG[timestamp_from]" = "date" || -z "$ts" || "$ts" = "0" ]]; then
|
||||
ts="$( date +%s )"
|
||||
fi
|
||||
|
||||
local fd datafile="${ZCONVEY_IO_DIR}/${id}.io"
|
||||
local lockfile="${datafile}.lock"
|
||||
{ echo "PID $$ ID $ZCONVEY_ID is sending command" >! "$lockfile"; } 2>/dev/null
|
||||
|
||||
# 1. Zsh lock with timeout (2 seconds)
|
||||
if (( ${ZCONVEY_CONFIG[use_zsystem_flock]} > 0 )); then
|
||||
(( ${verbose} )) && print "Will use zsystem flock..."
|
||||
if ! zsystem flock -t 2 -f fd "$lockfile"; then
|
||||
__zconvey_pinfo2 "Communication channel of session $id is busy, could not send"
|
||||
return 1
|
||||
fi
|
||||
# 2. Provided flock binary (two calls)
|
||||
else
|
||||
(( ${verbose} )) && print "Will use provided flock..."
|
||||
exec {fd}>"$lockfile"
|
||||
"${ZCONVEY_REPO_DIR}/myflock/flock" -nx "$fd"
|
||||
if [ "$?" = "101" ]; then
|
||||
(( ${verbose} )) && print "First attempt failed, will retry..."
|
||||
LANG=C sleep 1
|
||||
"${ZCONVEY_REPO_DIR}/myflock/flock" -nx "$fd"
|
||||
if [ "$?" = "101" ]; then
|
||||
__zconvey_pinfo2 "Communication channel of session $id is busy, could not send"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# >> - multiple commands can be accumulated
|
||||
print -r -- "$ts $cmd" >>! "$datafile"
|
||||
|
||||
# Release the lock by closing the lock file
|
||||
exec {fd}>&-
|
||||
|
||||
if (( ${quiet} == 0 )); then
|
||||
__zconvey_get_name_of_id "$id"
|
||||
if [[ -n "$REPLY" ]]; then
|
||||
print "Zconvey successfully sent command to \033[1;32msession $id\033[0m (name: \033[1;32m$REPLY\033[0m)"
|
||||
else
|
||||
print "Zconvey successfully sent command to \033[1;32msession $id\033[0m"
|
||||
fi
|
||||
local busyfile="$ZCONVEY_OTHER_DIR/${id}.busy"
|
||||
[ -e "$busyfile" ] && print "The session is busy \033[1;33m($(<$busyfile))\033[0m (command will time out after ${ZCONVEY_CONFIG[expire_seconds]}s)"
|
||||
|
||||
integer is_locked
|
||||
__zconvey_is_session_active "$id" && is_locked=1 || is_locked=0
|
||||
(( is_locked == 0 )) && print "The session is ABSENT, the command will probably time out (after ${ZCONVEY_CONFIG[expire_seconds]}s)"
|
||||
fi
|
||||
|
||||
# vim:ft=zsh
|
||||
100
zc-all
Normal file
100
zc-all
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
setopt localoptions extendedglob clobber
|
||||
integer idx is_locked counter=0
|
||||
local name busyfile busywith
|
||||
|
||||
__zconvey_usage_zc-all() {
|
||||
__zconvey_pinfo2 "Sends command to all unbusy sessions (also busy when -f passed)"
|
||||
__zconvey_pinfo "Usage: zc-all [-h|--help] [-f|--force] [-a|--ask] [-q|--quiet] [-v|--verbose] COMMAND ARGUMENT ..."
|
||||
print -- "-h/--help - this message"
|
||||
print -- "-q/--quiet - don't output status messages"
|
||||
print -- "-v/--verbose - output more status messages"
|
||||
print -- "-a/--ask - ask for command (if not provided)"
|
||||
print -- "-f/--force - send also to busy sessions; command can time out"
|
||||
}
|
||||
|
||||
local -A opthash
|
||||
zparseopts -D -A opthash h -help q -quiet v -verbose f -force a -ask || { __zconvey_usage_zc-all; return 1; }
|
||||
|
||||
integer verbose=0 quiet=0 force=0 ask=0
|
||||
|
||||
# Help
|
||||
(( ${+opthash[-h]} + ${+opthash[--help]} )) && { __zconvey_usage_zc-all; return 0; }
|
||||
|
||||
# ASK (requests command and/or ID)
|
||||
(( ask = ${+opthash[-a]} + ${+opthash[--ask]} ))
|
||||
if [ "$ask" = "0" ]; then
|
||||
local ask_setting
|
||||
zstyle -b ":plugin:zconvey" ask ask_setting || ask_setting="no"
|
||||
[ "$ask_setting" = "yes" ] && ask=1 || ask=0
|
||||
fi
|
||||
|
||||
# VERBOSE, QUIET, FORCE
|
||||
(( verbose = ${+opthash[-v]} + ${+opthash[--verbose]} ))
|
||||
(( quiet = ${+opthash[-q]} + ${+opthash[--quiet]} ))
|
||||
(( force = ${+opthash[-f]} + ${+opthash[--force]} ))
|
||||
|
||||
local -a args
|
||||
args=( "${(q)@}" )
|
||||
|
||||
local cmd="${args[*]}"
|
||||
cmd="${cmd//\\;/;}"
|
||||
cmd="${cmd//\\|/|}"
|
||||
cmd="${cmd//\\&/&}"
|
||||
cmd="${cmd##[[:space:]]#}"
|
||||
cmd="${cmd%%[[:space:]]#}"
|
||||
|
||||
# Resupply missing input if requested
|
||||
if (( $ask )); then
|
||||
# Supply command?
|
||||
if [[ -z "$cmd" ]]; then
|
||||
vared -cp "Enter command to send: " cmd
|
||||
cmd="${cmd##[[:space:]]#}"
|
||||
cmd="${cmd%%[[:space:]]#}"
|
||||
if [ -z "$cmd" ]; then
|
||||
__zconvey_pinfo "No command enterred, exiting"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$cmd" ]; then
|
||||
__zconvey_pinfo "No command provided, aborting"
|
||||
return 1
|
||||
fi
|
||||
|
||||
for (( idx = 1; idx <= 100; idx ++ )); do
|
||||
name=""
|
||||
busywith=""
|
||||
is_locked=0
|
||||
|
||||
__zconvey_is_session_active "$idx" && is_locked=1 || is_locked=0
|
||||
|
||||
if (( is_locked )); then
|
||||
busyfile="$ZCONVEY_OTHER_DIR/${idx}.busy"
|
||||
if [[ -e "$busyfile" && "$idx" != "$ZCONVEY_ID" ]]; then
|
||||
busywith="\033[1;33m$(<$busyfile)\033[0m"
|
||||
|
||||
__zconvey_get_name_of_id "$idx"
|
||||
if (( force )); then
|
||||
counter+=1
|
||||
(( quiet )) || print "\033[1;35mSending to busy\033[0m session $idx (name: $REPLY, busy with: $busywith)"
|
||||
zc -qi "$idx" -r "${cmd[@]}"
|
||||
else
|
||||
(( quiet )) || print "Session $idx (name: $REPLY) busy ($busywith)"
|
||||
fi
|
||||
elif [[ "$idx" != "$ZCONVEY_ID" ]]; then
|
||||
counter+=1
|
||||
if (( verbose )); then
|
||||
zc -i "$idx" -r "${cmd[@]}"
|
||||
else
|
||||
zc -qi "$idx" -r "${cmd[@]}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
(( quiet )) || __zconvey_pinfo "Sent command to $counter other sessions"
|
||||
|
||||
return 0
|
||||
|
||||
# vim:ft=zsh
|
||||
36
zc-logo
Normal file
36
zc-logo
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# Prints a graphical "logo" with ID and NAME
|
||||
setopt localoptions extendedglob
|
||||
|
||||
integer halfl=$(( LINES / 2 )) halfc=$(( COLUMNS / 2 ))
|
||||
integer hlen tlen
|
||||
local text headerline=" Zconvey" headerline2=""
|
||||
|
||||
__zconvey_get_name_of_id "$ZCONVEY_ID"
|
||||
if [ -z "$REPLY" ]; then
|
||||
text="ID: <$ZCONVEY_ID> NAME: (no name assigned)"
|
||||
else
|
||||
text="ID: <$ZCONVEY_ID> NAME: $REPLY"
|
||||
fi
|
||||
|
||||
tlen="${#text}"
|
||||
hlen=tlen+4
|
||||
headerline="${(r:hlen:: :)headerline}"
|
||||
headerline="${headerline/Zconvey/\033[1;34mZconvey\033[0m\033[1;44m}"
|
||||
headerline2="${(r:hlen:: :)headerline2}"
|
||||
text="${text/(#b)(<[[:digit:]]#>)/\033[1;32m${match[1]}\033[1;33m}"
|
||||
text="${text/(#b)NAME: (?#)/NAME: \033[1;32m${match[1]}\033[0m}"
|
||||
|
||||
[ "$1" != "echo" ] && {
|
||||
echotc sc
|
||||
echotc cm $(( halfl - 3 )) $(( halfc - hlen/2 ))
|
||||
print -n "\033[1;44m$headerline\033[0m"
|
||||
echotc cm $(( halfl - 2 )) $(( halfc - hlen/2 ))
|
||||
print -n "\033[1;44m \033[0m \033[1;33m$text\033[0m \033[1;44m \033[0m"
|
||||
echotc cm $(( halfl - 1 )) $(( halfc - hlen/2 ))
|
||||
print -n "\033[1;44m$headerline2\033[0m"
|
||||
echotc rc
|
||||
} || {
|
||||
print "\033[1;44m$headerline\033[0m\n\033[1;44m \033[0m \033[1;33m$text\033[0m \033[1;44m \033[0m\n\033[1;44m$headerline2\033[0m"
|
||||
}
|
||||
|
||||
# vim:ft=zsh
|
||||
35
zc-logo-all
Normal file
35
zc-logo-all
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
setopt localoptions extendedglob clobber
|
||||
integer idx is_locked counter=0
|
||||
local busyfile busywith
|
||||
|
||||
if [[ "$1" = "-h" || "$1" = "--help" ]]; then
|
||||
__zconvey_pinfo "Sends zc-logo or zc-id to all terminals (the latter when argument \"text\" is passed)"
|
||||
return 0
|
||||
fi
|
||||
|
||||
for (( idx = 1; idx <= 100; idx ++ )); do
|
||||
name=""
|
||||
busywith=""
|
||||
is_locked=0
|
||||
|
||||
__zconvey_is_session_active "$idx" && is_locked=1 || is_locked=0
|
||||
|
||||
if (( is_locked )); then
|
||||
busyfile="$ZCONVEY_OTHER_DIR/${idx}.busy"
|
||||
if [[ -e "$busyfile" && "$idx" != "$ZCONVEY_ID" ]]; then
|
||||
busywith="\033[1;33m$(<$busyfile)\033[0m"
|
||||
|
||||
__zconvey_get_name_of_id "$idx"
|
||||
print "Session $idx (name: $REPLY) busy ($busywith), no logo request for it"
|
||||
else
|
||||
counter+=1
|
||||
[ "$1" = "text" ] && zc -qi "$idx" zc-id || zc -qi "$idx" zc-logo \&\& sleep 18
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
__zconvey_pinfo "Sent logo request to $counter sessions, including this one"
|
||||
|
||||
return 0
|
||||
|
||||
# vim:ft=zsh
|
||||
38
zc-ls
Normal file
38
zc-ls
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
setopt localoptions extendedglob clobber
|
||||
|
||||
integer idx is_locked
|
||||
local name busyfile busywith
|
||||
|
||||
for (( idx = 1; idx <= 100; idx ++ )); do
|
||||
name=""
|
||||
busywith=""
|
||||
|
||||
__zconvey_is_session_active "$idx" && is_locked=1 || is_locked=0
|
||||
|
||||
__zconvey_get_name_of_id "$idx"
|
||||
name="$REPLY"
|
||||
|
||||
busyfile="$ZCONVEY_OTHER_DIR/${idx}.busy"
|
||||
[[ -e "$busyfile" && "$idx" != "$ZCONVEY_ID" ]] && busywith=" \033[1;33m(BUSY: $(<$busyfile))\033[0m"
|
||||
|
||||
if [[ "$is_locked" = "0" && -n "$name" ]]; then
|
||||
print "\033[1;31m(ABSENT)\033[0m ID: $idx, NAME: $name"
|
||||
elif [[ "$is_locked" = "0" && -z "$name" ]]; then
|
||||
# Don't inform about absent, nameless sessions
|
||||
:
|
||||
elif [[ "$is_locked" = "1" && -z "$name" ]]; then
|
||||
if [ "$idx" = "$ZCONVEY_ID" ]; then
|
||||
print "\033[1;32m\033[4m(CURRENT) ID: $idx\033[0m$busywith"
|
||||
else
|
||||
print "\033[1;33m(ON-LINE)\033[0m ID: $idx$busywith"
|
||||
fi
|
||||
elif [[ "$is_locked" = "1" && -n "$name" ]]; then
|
||||
if [ "$idx" = "$ZCONVEY_ID" ]; then
|
||||
print "\033[1;32m\033[4m(CURRENT) ID: $idx, NAME: $name\033[0m$busywith"
|
||||
else
|
||||
print "\033[1;33m(ON-LINE)\033[0m ID: $idx, NAME: $name$busywith"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# vim:ft=zsh
|
||||
87
zc-rename
Normal file
87
zc-rename
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
setopt localoptions extendedglob clobber
|
||||
|
||||
function __zconvey_usage_zc-rename() {
|
||||
__zconvey_pinfo2 "Renames current Zsh session, or one given via ID or (old) NAME"
|
||||
__zconvey_pinfo "Usage: zc-rename [-i ID|-n NAME] [-q|--quiet] [-h|--help] NEW_NAME"
|
||||
print -- "-h/--help - this message"
|
||||
print -- "-i ID / --id ID - ID (number) of Zsh session"
|
||||
print -- "-n NAME / --name NAME - NAME of Zsh session"
|
||||
print -- "-q/--quiet - don't output status messages"
|
||||
}
|
||||
|
||||
local -A opthash
|
||||
zparseopts -E -D -A opthash h -help q -quiet i: -id: n: -name: || { __zconvey_usage_zc-rename; return 1; }
|
||||
|
||||
integer have_id=0 have_name=0 quiet=0
|
||||
local id name new_name="$1"
|
||||
|
||||
# Help
|
||||
(( ${+opthash[-h]} + ${+opthash[--help]} )) && { __zconvey_usage_zc-rename; return 0; }
|
||||
[ -z "$new_name" ] && { echo "No new name given"; __zconvey_usage_zc-rename; return 1; }
|
||||
|
||||
# ID
|
||||
have_id=$(( ${+opthash[-i]} + ${+opthash[--id]} ))
|
||||
(( ${+opthash[-i]} )) && id="${opthash[-i]}"
|
||||
(( ${+opthash[--id]} )) && id="${opthash[--id]}"
|
||||
|
||||
# NAME
|
||||
have_name=$(( ${+opthash[-n]} + ${+opthash[--name]} ))
|
||||
(( ${+opthash[-n]} )) && name="${opthash[-n]}"
|
||||
(( ${+opthash[--name]} )) && name="${opthash[--name]}"
|
||||
|
||||
# QUIET
|
||||
(( quiet = ${+opthash[-q]} + ${+opthash[--quiet]} ))
|
||||
|
||||
if [[ "$have_id" != "0" && "$have_name" != "0" ]]; then
|
||||
__zconvey_pinfo "Please supply only one of ID (-i) and NAME (-n)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$have_id" != "0" && ( "$id" != <-> || "$id" = "0" ) ]]; then
|
||||
__zconvey_pinfo "ID must be numeric, 1..100"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Rename via NAME?
|
||||
if (( $have_name )); then
|
||||
__zconvey_resolve_name_to_id "$name"
|
||||
local resolved="$REPLY"
|
||||
if [ -z "$resolved" ]; then
|
||||
__zconvey_pinfo "Could not find session named: \`$name'"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Store the resolved ID and continue normally,
|
||||
# with ID as the main specifier of session
|
||||
id="$resolved"
|
||||
elif (( $have_id == 0 )); then
|
||||
id="$ZCONVEY_ID"
|
||||
fi
|
||||
|
||||
__zconvey_resolve_name_to_id "$new_name"
|
||||
if [ -n "$REPLY" ]; then
|
||||
__zconvey_pinfo "A session already has target name: \`$new_name' (its ID: $REPLY)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$id" != <-> || "$id" = "0" ]]; then
|
||||
__zconvey_pinfo "Bad ID ($id), aborting"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$id" -gt "100" ]]; then
|
||||
__zconvey_pinfo "Maximum nr of sessions is 100, aborting"
|
||||
return 1
|
||||
fi
|
||||
|
||||
print ":$new_name:" > "$ZCONVEY_NAMES_DIR"/"$id".name
|
||||
|
||||
if (( ${quiet} == 0 )); then
|
||||
__zconvey_pinfo2 "Renamed session $id to: $new_name"
|
||||
fi
|
||||
|
||||
local ls_after_rename
|
||||
zstyle -b ":plugin:zconvey" ls_after_rename ls_after_rename || ls_after_rename="no"
|
||||
[ "$ls_after_rename" = "yes" ] && print && zc-ls
|
||||
|
||||
# vim:ft=zsh
|
||||
107
zc-take
Normal file
107
zc-take
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
setopt localoptions extendedglob clobber
|
||||
|
||||
function __zconvey_usage_zc-take() {
|
||||
__zconvey_pinfo2 "Takes a name for current Zsh session, i.e. takes it away from any other session if needed"
|
||||
__zconvey_pinfo2 "You can take a name for other session (not the current one) if -i or -n is provided"
|
||||
__zconvey_pinfo "Usage: zc-take [-i ID|-n NAME] [-q|--quiet] [-h|--help] NEW_NAME"
|
||||
print -- "-h/--help - this message"
|
||||
print -- "-i ID / --id ID - ID (number) of Zsh session"
|
||||
print -- "-n NAME / --name NAME - NAME of Zsh session"
|
||||
print -- "-q/--quiet - don't output status messages"
|
||||
}
|
||||
|
||||
local -A opthash
|
||||
zparseopts -E -D -A opthash h -help q -quiet i: -id: n: -name: || { __zconvey_usage_zc-rename; return 1; }
|
||||
|
||||
integer have_id=0 have_name=0 quiet=0
|
||||
local id name new_name="$1"
|
||||
|
||||
# Help
|
||||
(( ${+opthash[-h]} + ${+opthash[--help]} )) && { __zconvey_usage_zc-take; return 0; }
|
||||
[ -z "$new_name" ] && { echo "No new name given"; __zconvey_usage_zc-take; return 1; }
|
||||
|
||||
# ID
|
||||
have_id=$(( ${+opthash[-i]} + ${+opthash[--id]} ))
|
||||
(( ${+opthash[-i]} )) && id="${opthash[-i]}"
|
||||
(( ${+opthash[--id]} )) && id="${opthash[--id]}"
|
||||
|
||||
# NAME
|
||||
have_name=$(( ${+opthash[-n]} + ${+opthash[--name]} ))
|
||||
(( ${+opthash[-n]} )) && name="${opthash[-n]}"
|
||||
(( ${+opthash[--name]} )) && name="${opthash[--name]}"
|
||||
|
||||
# QUIET
|
||||
(( quiet = ${+opthash[-q]} + ${+opthash[--quiet]} ))
|
||||
|
||||
if [[ "$have_id" != "0" && "$have_name" != "0" ]]; then
|
||||
__zconvey_pinfo "Please supply only one of ID (-i) and NAME (-n)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$have_id" != "0" && ( "$id" != <-> || "$id" = "0" ) ]]; then
|
||||
__zconvey_pinfo "ID must be numeric, 1..100"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Rename via NAME?
|
||||
if (( $have_name )); then
|
||||
__zconvey_resolve_name_to_id "$name"
|
||||
local resolved="$REPLY"
|
||||
if [ -z "$resolved" ]; then
|
||||
echo "Could not find session named: \`$name'"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Store the resolved ID and continue normally,
|
||||
# with ID as the main specifier of session
|
||||
id="$resolved"
|
||||
elif (( $have_id == 0 )); then
|
||||
id="$ZCONVEY_ID"
|
||||
fi
|
||||
|
||||
if [[ "$id" != <-> || "$id" = "0" ]]; then
|
||||
__zconvey_pinfo "Bad ID ($id), aborting"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$id" -gt "100" ]]; then
|
||||
__zconvey_pinfo "Maximum nr of sessions is 100, aborting"
|
||||
return 1
|
||||
fi
|
||||
|
||||
__zconvey_resolve_name_to_id "$new_name"
|
||||
local other_id="$REPLY"
|
||||
if [ -n "$other_id" ]; then
|
||||
# The new name exist in system - find an
|
||||
# altered name that doesn't exist in system
|
||||
# and rename conflicting session, so that
|
||||
# $new_name is free
|
||||
integer counter=1
|
||||
local subst_name
|
||||
while (( 1 )); do
|
||||
counter+=1
|
||||
subst_name="${new_name%%_[[:digit:]]#}_${counter}"
|
||||
__zconvey_resolve_name_to_id "$subst_name"
|
||||
if [ -z "$REPLY" ]; then
|
||||
# Found a name that doesn't exist in system, assign
|
||||
# it to the initial conflicting session $new_name
|
||||
print ":$subst_name:" > "$ZCONVEY_NAMES_DIR"/"$other_id".name
|
||||
|
||||
(( ${quiet} == 0 )) && __zconvey_pinfo "Pre-rename: $new_name -> $subst_name"
|
||||
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
print ":$new_name:" > "$ZCONVEY_NAMES_DIR"/"$id".name
|
||||
|
||||
if (( ${quiet} == 0 )); then
|
||||
__zconvey_pinfo2 "Renamed session $id to: $new_name"
|
||||
fi
|
||||
|
||||
local ls_after_rename
|
||||
zstyle -b ":plugin:zconvey" ls_after_rename ls_after_rename || ls_after_rename="no"
|
||||
[ "$ls_after_rename" = "yes" ] && print && zc-ls
|
||||
|
||||
# vim:ft=zsh
|
||||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue