newsline-cli 0.1.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -1
- package/newsline +98 -6
- package/package.json +1 -1
- package/readme/de.md +25 -1
- package/readme/es.md +25 -1
- package/readme/fr.md +25 -1
- package/readme/ja.md +25 -1
- package/readme/ko.md +25 -1
- package/readme/pt.md +25 -1
- package/readme/zh.md +24 -1
- package/refresh.sh +1 -1
- package/statusline.sh +21 -3
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ npm i -g newsline-cli && newsline init
|
|
|
29
29
|
/plugin install newsline@itdar
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
The news line appears on your **next message** — no restart. Setup asks for a language &
|
|
32
|
+
The news line appears on your **next message** — no restart. Setup asks for a language, topic & headline color
|
|
33
33
|
and keeps your existing status line.
|
|
34
34
|
|
|
35
35
|
## What it does
|
|
@@ -70,6 +70,30 @@ Re-run `newsline init`, or edit `~/.config/newsline/config.json`:
|
|
|
70
70
|
| `count` | `15` | headlines in rotation |
|
|
71
71
|
| `maxlen` | `120` | max characters (`max` = no cut) |
|
|
72
72
|
| `icon` | `📰` | leading glyph (`none` to hide) |
|
|
73
|
+
| `color` | `cyan` | headline color: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
|
|
74
|
+
|
|
75
|
+
Set one directly with `newsline color <name>` (e.g. `newsline color gray`), or run
|
|
76
|
+
`newsline color` with no name to step to the next color (default → gray → white → cyan →
|
|
77
|
+
yellow → green → blue → magenta → red). `newsline colorlist` lists them all with a live
|
|
78
|
+
preview. Changes show on the next status-line tick.
|
|
79
|
+
|
|
80
|
+
## Update
|
|
81
|
+
|
|
82
|
+
Update the same way you installed — your language/topic/color settings are kept:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
# curl — re-run the installer (skips setup, just refreshes the CLI)
|
|
86
|
+
curl -fsSL https://raw.githubusercontent.com/itdar/newsline/master/install.sh | NEWSLINE_NO_INIT=1 sh
|
|
87
|
+
|
|
88
|
+
# Homebrew
|
|
89
|
+
brew update && brew upgrade newsline
|
|
90
|
+
|
|
91
|
+
# npm
|
|
92
|
+
npm i -g newsline-cli@latest
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Claude Code plugin: run `/plugin marketplace update itdar`, then `/reload-plugins`
|
|
96
|
+
(or restart). You can also enable background auto-update under `/plugin` → **Marketplaces**.
|
|
73
97
|
|
|
74
98
|
## Uninstall
|
|
75
99
|
|
package/newsline
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
# newsline init interactive setup: language, topic, status-line wiring.
|
|
5
5
|
# COMPOSES with an existing status line (e.g. your HUD),
|
|
6
6
|
# so rate-limit / context info stays visible.
|
|
7
|
+
# newsline color [c] set the headline color (or cycle to the next when no name).
|
|
8
|
+
# newsline colorlist list the available headline colors with a live preview.
|
|
7
9
|
# newsline render what settings.json runs each refresh (base HUD + news).
|
|
8
10
|
# newsline refresh force a cache refresh now.
|
|
9
11
|
# newsline once fetch + print headlines once (debug).
|
|
@@ -77,8 +79,8 @@ load_config() {
|
|
|
77
79
|
import json,sys,shlex
|
|
78
80
|
env={"lang":"NEWSLINE_LANG","topic":"NEWSLINE_TOPIC","rotate":"NEWSLINE_ROTATE",
|
|
79
81
|
"count":"NEWSLINE_COUNT","maxlen":"NEWSLINE_MAXLEN","icon":"NEWSLINE_ICON",
|
|
80
|
-
"
|
|
81
|
-
"base_statusline":"NEWSLINE_BASE"}
|
|
82
|
+
"color":"NEWSLINE_COLOR","linkhint":"NEWSLINE_LINKHINT","api":"NEWSLINE_API",
|
|
83
|
+
"endpoint":"NEWSLINE_ENDPOINT","base_statusline":"NEWSLINE_BASE"}
|
|
82
84
|
try: d=json.load(open(sys.argv[1]))
|
|
83
85
|
except Exception: d={}
|
|
84
86
|
for k,name in env.items():
|
|
@@ -152,7 +154,7 @@ cmd_once() {
|
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
cmd_init() {
|
|
155
|
-
local lang="" topic="" api="" endpoint="" rotate="6" count="15" compose="auto" yes="0" base_override="" a
|
|
157
|
+
local lang="" topic="" color="" api="" endpoint="" rotate="6" count="15" compose="auto" yes="0" base_override="" a
|
|
156
158
|
while [ $# -gt 0 ]; do
|
|
157
159
|
case "$1" in
|
|
158
160
|
--lang) lang="$2"; shift 2;; --topic) topic="$2"; shift 2;;
|
|
@@ -189,8 +191,16 @@ cmd_init() {
|
|
|
189
191
|
sports "Sports" science "Science" health "Health" entertainment "Entertainment"
|
|
190
192
|
topic="$CHOICE"
|
|
191
193
|
fi
|
|
194
|
+
local cur_color; cur_color=$(cfg_get color)
|
|
195
|
+
echo "Select headline color (change anytime: newsline color):" >&2
|
|
196
|
+
choose "${cur_color:-cyan}" \
|
|
197
|
+
default "Terminal default" cyan "Cyan" gray "Gray" white "White" \
|
|
198
|
+
yellow "Yellow" green "Green" blue "Blue" magenta "Magenta" red "Red"
|
|
199
|
+
color="$CHOICE"
|
|
192
200
|
else
|
|
201
|
+
# --yes: keep a color previously set via init/`newsline color`; cyan on first run
|
|
193
202
|
lang="${lang:-$detected}"; topic="${topic:-general}"
|
|
203
|
+
color=$(cfg_get color); [ -n "$color" ] || color="cyan"
|
|
194
204
|
fi
|
|
195
205
|
|
|
196
206
|
# Always KEEP an existing status line and show newsline below it (no prompt).
|
|
@@ -210,13 +220,14 @@ cmd_init() {
|
|
|
210
220
|
fi
|
|
211
221
|
|
|
212
222
|
mkdir -p "$CONFIG_DIR"
|
|
213
|
-
python3 - "$CONFIG" "$lang" "$topic" "$rotate" "$count" "$api" "$endpoint" "$base" "$base_obj" <<'PY' || { echo "✗ could not write $CONFIG" >&2; return 1; }
|
|
223
|
+
python3 - "$CONFIG" "$lang" "$topic" "$rotate" "$count" "$api" "$endpoint" "$base" "$base_obj" "$color" <<'PY' || { echo "✗ could not write $CONFIG" >&2; return 1; }
|
|
214
224
|
import json,os,sys
|
|
215
|
-
_,path,lang,topic,rotate,count,api,endpoint,base,base_obj=sys.argv
|
|
225
|
+
_,path,lang,topic,rotate,count,api,endpoint,base,base_obj,color=sys.argv
|
|
216
226
|
try:
|
|
217
227
|
d={"lang":lang,"topic":topic,"rotate":int(rotate),"count":int(count)}
|
|
218
228
|
except ValueError:
|
|
219
229
|
sys.stderr.write("newsline: --rotate/--count must be integers\n"); sys.exit(3)
|
|
230
|
+
if color and color not in ("default","none","off"): d["color"]=color
|
|
220
231
|
if api: d["api"]=api
|
|
221
232
|
if endpoint: d["endpoint"]=endpoint
|
|
222
233
|
if base: d["base_statusline"]=base
|
|
@@ -257,6 +268,79 @@ PY
|
|
|
257
268
|
echo " It appears on your next message to Claude — no restart needed."
|
|
258
269
|
}
|
|
259
270
|
|
|
271
|
+
# canonical headline palette — single source of truth for cycling, listing, and
|
|
272
|
+
# validation. "default" means the terminal's own color (no SGR); the rest map to
|
|
273
|
+
# the SGR codes in statusline.sh (nl_sgr below mirrors that mapping).
|
|
274
|
+
NL_PALETTE="default gray white cyan yellow green blue magenta red"
|
|
275
|
+
|
|
276
|
+
nl_sgr() { # color name -> SGR params (empty = terminal default). Mirrors statusline.sh.
|
|
277
|
+
case "$1" in
|
|
278
|
+
dim) echo "2" ;;
|
|
279
|
+
gray|grey) echo "90" ;;
|
|
280
|
+
red) echo "31" ;; green) echo "32" ;; yellow) echo "33" ;;
|
|
281
|
+
blue) echo "34" ;; magenta) echo "35" ;; cyan) echo "36" ;;
|
|
282
|
+
white) echo "37" ;; orange) echo "38;5;208" ;;
|
|
283
|
+
*) echo "" ;;
|
|
284
|
+
esac
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
nl_write_color() { # nl_write_color <name> — persist the chosen color to config
|
|
288
|
+
mkdir -p "$CONFIG_DIR"
|
|
289
|
+
python3 - "$CONFIG" "$1" <<'PY' || { echo "✗ could not write $CONFIG" >&2; return 1; }
|
|
290
|
+
import json,os,sys
|
|
291
|
+
path,color=sys.argv[1],sys.argv[2]
|
|
292
|
+
try: d=json.load(open(path))
|
|
293
|
+
except Exception: d={}
|
|
294
|
+
if color in ("default","none","off"): d.pop("color",None)
|
|
295
|
+
else: d["color"]=color
|
|
296
|
+
tmp=path+".tmp"
|
|
297
|
+
with open(tmp,"w") as f: json.dump(d,f,indent=2,ensure_ascii=False)
|
|
298
|
+
os.replace(tmp,path)
|
|
299
|
+
PY
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
cmd_colorlist() { # newsline colorlist — list the palette, each shown in its own color
|
|
303
|
+
local cur c sgr mark; cur=$(cfg_get color); [ -n "$cur" ] || cur=default
|
|
304
|
+
echo "Headline colors (set with: newsline color <name>):"
|
|
305
|
+
for c in $NL_PALETTE; do
|
|
306
|
+
[ "$c" = "$cur" ] && mark=" ← current" || mark=""
|
|
307
|
+
sgr=$(nl_sgr "$c")
|
|
308
|
+
if [ -n "$sgr" ]; then
|
|
309
|
+
printf ' \033[%sm%-8s 📰 sample headline\033[0m%s\n' "$sgr" "$c" "$mark"
|
|
310
|
+
else
|
|
311
|
+
printf ' %-8s 📰 sample headline%s\n' "$c" "$mark"
|
|
312
|
+
fi
|
|
313
|
+
done
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
cmd_color() { # newsline color [name] — set a color; with no name, step to the next one
|
|
317
|
+
local cur new arg; arg="${1:-}"
|
|
318
|
+
case "$arg" in list|ls|--list) cmd_colorlist; return $? ;; esac
|
|
319
|
+
if [ -n "$arg" ]; then
|
|
320
|
+
new="$(printf '%s' "$arg" | tr '[:upper:]' '[:lower:]')"
|
|
321
|
+
case "$new" in grey) new=gray ;; none|off) new=default ;; esac
|
|
322
|
+
case " $NL_PALETTE " in
|
|
323
|
+
*" $new "*) ;;
|
|
324
|
+
*) echo "✗ unknown color: $arg" >&2
|
|
325
|
+
echo " choose from: $NL_PALETTE (see: newsline colorlist)" >&2
|
|
326
|
+
return 1 ;;
|
|
327
|
+
esac
|
|
328
|
+
else # no name: cycle to the next color, wrapping
|
|
329
|
+
cur=$(cfg_get color)
|
|
330
|
+
new=$(NL_PALETTE="$NL_PALETTE" python3 - "${cur:-default}" <<'PY'
|
|
331
|
+
import os,sys
|
|
332
|
+
p=os.environ["NL_PALETTE"].split()
|
|
333
|
+
c=sys.argv[1]
|
|
334
|
+
print(p[(p.index(c)+1)%len(p)] if c in p else p[0])
|
|
335
|
+
PY
|
|
336
|
+
)
|
|
337
|
+
fi
|
|
338
|
+
nl_write_color "$new" || return 1
|
|
339
|
+
echo "✔ headline color: $new — preview:"
|
|
340
|
+
load_config
|
|
341
|
+
"$HERE/statusline.sh"; echo
|
|
342
|
+
}
|
|
343
|
+
|
|
260
344
|
cmd_uninstall() {
|
|
261
345
|
local base base_obj
|
|
262
346
|
base=$(cfg_get base_statusline)
|
|
@@ -299,7 +383,13 @@ PY
|
|
|
299
383
|
usage() {
|
|
300
384
|
cat <<'EOF'
|
|
301
385
|
newsline — local news status-line utility
|
|
302
|
-
newsline init [--lang ko] [--topic tech]
|
|
386
|
+
newsline init [--lang ko] [--topic tech] set up & wire the status line
|
|
387
|
+
(asks language / topic / color)
|
|
388
|
+
newsline color [name] set headline color (e.g. cyan, gray); with
|
|
389
|
+
no name, step to the next: default → gray →
|
|
390
|
+
white → cyan → yellow → green → blue →
|
|
391
|
+
magenta → red → back to default
|
|
392
|
+
newsline colorlist list the available colors with a preview
|
|
303
393
|
newsline uninstall remove & restore previous status line
|
|
304
394
|
EOF
|
|
305
395
|
if [ "${1:-}" = "--all" ]; then
|
|
@@ -318,6 +408,8 @@ case "${1:-help}" in
|
|
|
318
408
|
refresh) shift; cmd_refresh "$@";;
|
|
319
409
|
once) shift; cmd_once "$@";;
|
|
320
410
|
init) shift; cmd_init "$@";;
|
|
411
|
+
color) shift; cmd_color "$@";;
|
|
412
|
+
colorlist|colors) shift; cmd_colorlist;;
|
|
321
413
|
uninstall) shift; cmd_uninstall "$@";;
|
|
322
414
|
help|-h|--help) shift; usage "$@";;
|
|
323
415
|
*) usage; exit 1;;
|
package/package.json
CHANGED
package/readme/de.md
CHANGED
|
@@ -31,7 +31,7 @@ npm i -g newsline-cli && newsline init
|
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Die News-Zeile erscheint bei deiner **nächsten Nachricht** – kein Neustart nötig. Die Einrichtung fragt
|
|
34
|
-
nach Sprache und
|
|
34
|
+
nach Sprache, Thema und Schlagzeilenfarbe und behält deine bestehende Statusleiste bei.
|
|
35
35
|
|
|
36
36
|
## Was es macht
|
|
37
37
|
|
|
@@ -73,6 +73,30 @@ Führe `newsline init` erneut aus oder bearbeite `~/.config/newsline/config.json
|
|
|
73
73
|
| `count` | `15` | Schlagzeilen im Wechsel |
|
|
74
74
|
| `maxlen` | `120` | maximale Zeichen (`max` = kein Abschneiden) |
|
|
75
75
|
| `icon` | `📰` | vorangestelltes Symbol (`none` zum Ausblenden) |
|
|
76
|
+
| `color` | `cyan` | Farbe der Schlagzeile: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
|
|
77
|
+
|
|
78
|
+
Eine direkt setzen mit `newsline color <name>` (z. B. `newsline color gray`), oder
|
|
79
|
+
`newsline color` ohne Namen ausführen, um zur nächsten Farbe zu wechseln (default → gray →
|
|
80
|
+
white → cyan → yellow → green → blue → magenta → red). `newsline colorlist` listet alle mit
|
|
81
|
+
Vorschau auf; Änderungen erscheinen beim nächsten Statuszeilen-Refresh.
|
|
82
|
+
|
|
83
|
+
## Aktualisieren
|
|
84
|
+
|
|
85
|
+
Aktualisiere so, wie du installiert hast — deine Sprache/Thema/Farbe bleiben erhalten:
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
# curl — Installer erneut ausführen (überspringt die Einrichtung, aktualisiert nur die CLI)
|
|
89
|
+
curl -fsSL https://raw.githubusercontent.com/itdar/newsline/master/install.sh | NEWSLINE_NO_INIT=1 sh
|
|
90
|
+
|
|
91
|
+
# Homebrew
|
|
92
|
+
brew update && brew upgrade newsline
|
|
93
|
+
|
|
94
|
+
# npm
|
|
95
|
+
npm i -g newsline-cli@latest
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Claude-Code-Plugin: `/plugin marketplace update itdar`, dann `/reload-plugins`
|
|
99
|
+
(oder neu starten). Aktiviere die automatische Aktualisierung unter `/plugin` → **Marketplaces**.
|
|
76
100
|
|
|
77
101
|
## Deinstallieren
|
|
78
102
|
|
package/readme/es.md
CHANGED
|
@@ -30,7 +30,7 @@ npm i -g newsline-cli && newsline init
|
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
La línea de noticias aparece en tu **próximo mensaje**, sin reiniciar. La configuración te pregunta el
|
|
33
|
-
idioma y el
|
|
33
|
+
idioma, el tema y el color del titular, y conserva tu barra de estado actual.
|
|
34
34
|
|
|
35
35
|
## Qué hace
|
|
36
36
|
|
|
@@ -72,6 +72,30 @@ Vuelve a ejecutar `newsline init` o edita `~/.config/newsline/config.json`:
|
|
|
72
72
|
| `count` | `15` | titulares en rotación |
|
|
73
73
|
| `maxlen` | `120` | caracteres máximos (`max` = sin recorte) |
|
|
74
74
|
| `icon` | `📰` | icono inicial (`none` para ocultarlo) |
|
|
75
|
+
| `color` | `cyan` | color del titular: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
|
|
76
|
+
|
|
77
|
+
Fija uno directamente con `newsline color <nombre>` (p. ej. `newsline color gray`), o usa
|
|
78
|
+
`newsline color` sin nombre para pasar al siguiente color (default → gray → white → cyan →
|
|
79
|
+
yellow → green → blue → magenta → red). `newsline colorlist` los muestra todos con una
|
|
80
|
+
vista previa; los cambios se ven en el próximo refresco de la línea de estado.
|
|
81
|
+
|
|
82
|
+
## Actualizar
|
|
83
|
+
|
|
84
|
+
Actualiza igual que instalaste — se conservan tus ajustes de idioma/tema/color:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
# curl — vuelve a ejecutar el instalador (omite la configuración, solo actualiza la CLI)
|
|
88
|
+
curl -fsSL https://raw.githubusercontent.com/itdar/newsline/master/install.sh | NEWSLINE_NO_INIT=1 sh
|
|
89
|
+
|
|
90
|
+
# Homebrew
|
|
91
|
+
brew update && brew upgrade newsline
|
|
92
|
+
|
|
93
|
+
# npm
|
|
94
|
+
npm i -g newsline-cli@latest
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Plugin de Claude Code: ejecuta `/plugin marketplace update itdar` y luego `/reload-plugins`
|
|
98
|
+
(o reinicia). También puedes activar la actualización automática en `/plugin` → **Marketplaces**.
|
|
75
99
|
|
|
76
100
|
## Desinstalar
|
|
77
101
|
|
package/readme/fr.md
CHANGED
|
@@ -30,7 +30,7 @@ npm i -g newsline-cli && newsline init
|
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
La ligne d'actualité apparaît dès votre **prochain message** — sans redémarrage. La configuration vous
|
|
33
|
-
demande une langue et
|
|
33
|
+
demande une langue, un thème et une couleur de titre, et conserve votre barre d'état existante.
|
|
34
34
|
|
|
35
35
|
## Ce que ça fait
|
|
36
36
|
|
|
@@ -73,6 +73,30 @@ Relancez `newsline init`, ou modifiez `~/.config/newsline/config.json` :
|
|
|
73
73
|
| `count` | `15` | titres en rotation |
|
|
74
74
|
| `maxlen` | `120` | caractères maximum (`max` = sans coupure) |
|
|
75
75
|
| `icon` | `📰` | icône de tête (`none` pour masquer) |
|
|
76
|
+
| `color` | `cyan` | couleur du titre : `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
|
|
77
|
+
|
|
78
|
+
Définissez-en une directement avec `newsline color <nom>` (p. ex. `newsline color gray`), ou
|
|
79
|
+
utilisez `newsline color` sans nom pour passer à la couleur suivante (default → gray → white →
|
|
80
|
+
cyan → yellow → green → blue → magenta → red). `newsline colorlist` les liste toutes avec un
|
|
81
|
+
aperçu ; les changements sont visibles au prochain rafraîchissement de la ligne d'état.
|
|
82
|
+
|
|
83
|
+
## Mettre à jour
|
|
84
|
+
|
|
85
|
+
Mettez à jour comme vous avez installé — vos réglages de langue/thème/couleur sont conservés :
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
# curl — relancez l'installateur (ignore la configuration, met juste à jour la CLI)
|
|
89
|
+
curl -fsSL https://raw.githubusercontent.com/itdar/newsline/master/install.sh | NEWSLINE_NO_INIT=1 sh
|
|
90
|
+
|
|
91
|
+
# Homebrew
|
|
92
|
+
brew update && brew upgrade newsline
|
|
93
|
+
|
|
94
|
+
# npm
|
|
95
|
+
npm i -g newsline-cli@latest
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Plugin Claude Code : `/plugin marketplace update itdar`, puis `/reload-plugins`
|
|
99
|
+
(ou redémarrez). Activez la mise à jour automatique dans `/plugin` → **Marketplaces**.
|
|
76
100
|
|
|
77
101
|
## Désinstaller
|
|
78
102
|
|
package/readme/ja.md
CHANGED
|
@@ -29,7 +29,7 @@ npm i -g newsline-cli && newsline init
|
|
|
29
29
|
/plugin install newsline@itdar
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
ニュース行は **次のメッセージ** で表示されます —
|
|
32
|
+
ニュース行は **次のメッセージ** で表示されます — 再起動は不要です。セットアップで言語・トピック・文字色を
|
|
33
33
|
尋ね、既存のステータスラインはそのまま保持します。
|
|
34
34
|
|
|
35
35
|
## 何をするか
|
|
@@ -71,6 +71,30 @@ npm i -g newsline-cli && newsline init
|
|
|
71
71
|
| `count` | `15` | 切り替えるヘッドライン数 |
|
|
72
72
|
| `maxlen` | `120` | 最大文字数(`max` = 無制限) |
|
|
73
73
|
| `icon` | `📰` | 先頭アイコン(`none` で非表示) |
|
|
74
|
+
| `color` | `cyan` | 見出しの文字色:`default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
|
|
75
|
+
|
|
76
|
+
`newsline color <名前>` で色を直接指定でき(例:`newsline color gray`)、名前なしで
|
|
77
|
+
`newsline color` を実行すると次の色へ進みます(default → gray → white → cyan → yellow →
|
|
78
|
+
green → blue → magenta → red)。`newsline colorlist` で全色をプレビュー付きで一覧でき、
|
|
79
|
+
変更は次のステータスライン更新で反映されます。
|
|
80
|
+
|
|
81
|
+
## アップデート
|
|
82
|
+
|
|
83
|
+
インストールした方法と同じ手順で更新できます — 言語・トピック・色の設定は保持されます:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
# curl — インストーラを再実行(セットアップはスキップし、CLI のみ更新)
|
|
87
|
+
curl -fsSL https://raw.githubusercontent.com/itdar/newsline/master/install.sh | NEWSLINE_NO_INIT=1 sh
|
|
88
|
+
|
|
89
|
+
# Homebrew
|
|
90
|
+
brew update && brew upgrade newsline
|
|
91
|
+
|
|
92
|
+
# npm
|
|
93
|
+
npm i -g newsline-cli@latest
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Claude Code プラグイン: `/plugin marketplace update itdar` を実行後、`/reload-plugins`
|
|
97
|
+
(または再起動)。`/plugin` → **Marketplaces** でバックグラウンド自動更新も有効にできます。
|
|
74
98
|
|
|
75
99
|
## アンインストール
|
|
76
100
|
|
package/readme/ko.md
CHANGED
|
@@ -29,7 +29,7 @@ npm i -g newsline-cli && newsline init
|
|
|
29
29
|
/plugin install newsline@itdar
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
뉴스 줄은 **다음 메시지 때** 나타납니다 — 재시작 불필요. 셋업은
|
|
32
|
+
뉴스 줄은 **다음 메시지 때** 나타납니다 — 재시작 불필요. 셋업은 언어·분야·글자 색을 물어보고, 기존
|
|
33
33
|
상태줄은 유지합니다.
|
|
34
34
|
|
|
35
35
|
## 무엇을 하나
|
|
@@ -67,6 +67,30 @@ npm i -g newsline-cli && newsline init
|
|
|
67
67
|
| `count` | `15` | 회전 헤드라인 수 |
|
|
68
68
|
| `maxlen` | `120` | 최대 글자수 (`max`=무제한) |
|
|
69
69
|
| `icon` | `📰` | 앞 아이콘 (`none`이면 제거) |
|
|
70
|
+
| `color` | `cyan` | 뉴스 글자 색: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
|
|
71
|
+
|
|
72
|
+
`newsline color <이름>`으로 색을 바로 지정하거나(예: `newsline color gray`), 이름 없이
|
|
73
|
+
`newsline color`를 실행하면 다음 색으로 넘어갑니다 (default → gray → white → cyan →
|
|
74
|
+
yellow → green → blue → magenta → red). `newsline colorlist`로 전체 색 목록을 미리보기와
|
|
75
|
+
함께 확인할 수 있고, 변경은 다음 상태줄 갱신 때 반영됩니다.
|
|
76
|
+
|
|
77
|
+
## 업데이트
|
|
78
|
+
|
|
79
|
+
설치했던 방식 그대로 업데이트하면 됩니다 — 언어·분야·색 설정은 유지됩니다:
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
# curl — 설치 스크립트 재실행 (셋업은 건너뛰고 CLI만 갱신)
|
|
83
|
+
curl -fsSL https://raw.githubusercontent.com/itdar/newsline/master/install.sh | NEWSLINE_NO_INIT=1 sh
|
|
84
|
+
|
|
85
|
+
# Homebrew
|
|
86
|
+
brew update && brew upgrade newsline
|
|
87
|
+
|
|
88
|
+
# npm
|
|
89
|
+
npm i -g newsline-cli@latest
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Claude Code 플러그인: `/plugin marketplace update itdar` 실행 후 `/reload-plugins`
|
|
93
|
+
(또는 재시작). `/plugin` → **Marketplaces**에서 백그라운드 자동 업데이트도 켤 수 있습니다.
|
|
70
94
|
|
|
71
95
|
## 제거
|
|
72
96
|
|
package/readme/pt.md
CHANGED
|
@@ -30,7 +30,7 @@ npm i -g newsline-cli && newsline init
|
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
A linha de notícias aparece na sua **próxima mensagem** — sem reiniciar. A configuração pergunta o
|
|
33
|
-
idioma e
|
|
33
|
+
idioma, o tema e a cor da manchete, e mantém a sua barra de status atual.
|
|
34
34
|
|
|
35
35
|
## O que faz
|
|
36
36
|
|
|
@@ -71,6 +71,30 @@ Execute `newsline init` novamente ou edite `~/.config/newsline/config.json`:
|
|
|
71
71
|
| `count` | `15` | manchetes na rotação |
|
|
72
72
|
| `maxlen` | `120` | máximo de caracteres (`max` = sem corte) |
|
|
73
73
|
| `icon` | `📰` | ícone inicial (`none` para ocultar) |
|
|
74
|
+
| `color` | `cyan` | cor da manchete: `default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
|
|
75
|
+
|
|
76
|
+
Defina uma diretamente com `newsline color <nome>` (ex.: `newsline color gray`), ou use
|
|
77
|
+
`newsline color` sem nome para avançar para a próxima cor (default → gray → white → cyan →
|
|
78
|
+
yellow → green → blue → magenta → red). `newsline colorlist` mostra todas com uma prévia;
|
|
79
|
+
as mudanças aparecem no próximo refresh da linha de status.
|
|
80
|
+
|
|
81
|
+
## Atualizar
|
|
82
|
+
|
|
83
|
+
Atualize da mesma forma que instalou — suas configurações de idioma/tema/cor são mantidas:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
# curl — execute o instalador de novo (pula a configuração, só atualiza a CLI)
|
|
87
|
+
curl -fsSL https://raw.githubusercontent.com/itdar/newsline/master/install.sh | NEWSLINE_NO_INIT=1 sh
|
|
88
|
+
|
|
89
|
+
# Homebrew
|
|
90
|
+
brew update && brew upgrade newsline
|
|
91
|
+
|
|
92
|
+
# npm
|
|
93
|
+
npm i -g newsline-cli@latest
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Plugin do Claude Code: `/plugin marketplace update itdar` e depois `/reload-plugins`
|
|
97
|
+
(ou reinicie). Ative a atualização automática em `/plugin` → **Marketplaces**.
|
|
74
98
|
|
|
75
99
|
## Desinstalar
|
|
76
100
|
|
package/readme/zh.md
CHANGED
|
@@ -29,7 +29,7 @@ npm i -g newsline-cli && newsline init
|
|
|
29
29
|
/plugin install newsline@itdar
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
新闻行会在你的 **下一条消息**
|
|
32
|
+
新闻行会在你的 **下一条消息** 时出现——无需重启。设置会询问语言、主题和文字颜色,并保留你现有的状态栏。
|
|
33
33
|
|
|
34
34
|
## 它做什么
|
|
35
35
|
|
|
@@ -65,6 +65,29 @@ npm i -g newsline-cli && newsline init
|
|
|
65
65
|
| `count` | `15` | 轮播头条数量 |
|
|
66
66
|
| `maxlen` | `120` | 最大字符数(`max` = 不截断) |
|
|
67
67
|
| `icon` | `📰` | 前置图标(`none` 为隐藏) |
|
|
68
|
+
| `color` | `cyan` | 新闻文字颜色:`default` `gray` `white` `cyan` `yellow` `green` `blue` `magenta` `red` |
|
|
69
|
+
|
|
70
|
+
用 `newsline color <名称>` 直接设置颜色(如 `newsline color gray`),或不带名称运行
|
|
71
|
+
`newsline color` 切换到下一种颜色(default → gray → white → cyan → yellow → green → blue →
|
|
72
|
+
magenta → red)。`newsline colorlist` 会列出所有颜色并附带预览,更改在下次状态栏刷新时生效。
|
|
73
|
+
|
|
74
|
+
## 更新
|
|
75
|
+
|
|
76
|
+
按你安装的方式更新即可 — 语言/主题/颜色设置会保留:
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
# curl — 重新运行安装脚本(跳过设置,仅更新 CLI)
|
|
80
|
+
curl -fsSL https://raw.githubusercontent.com/itdar/newsline/master/install.sh | NEWSLINE_NO_INIT=1 sh
|
|
81
|
+
|
|
82
|
+
# Homebrew
|
|
83
|
+
brew update && brew upgrade newsline
|
|
84
|
+
|
|
85
|
+
# npm
|
|
86
|
+
npm i -g newsline-cli@latest
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Claude Code 插件:运行 `/plugin marketplace update itdar`,然后 `/reload-plugins`
|
|
90
|
+
(或重启)。也可在 `/plugin` → **Marketplaces** 中启用后台自动更新。
|
|
68
91
|
|
|
69
92
|
## 卸载
|
|
70
93
|
|
package/refresh.sh
CHANGED
|
@@ -23,7 +23,7 @@ case "$API" in off|OFF|none|local) API="" ;; esac
|
|
|
23
23
|
COUNT="${NEWSLINE_COUNT:-15}" # how many headlines to cache for rotation
|
|
24
24
|
# Client version, sent to /feed as ?v= for the server-side update nudge.
|
|
25
25
|
# Bump together with package.json when tagging a release.
|
|
26
|
-
export NEWSLINE_VERSION="${NEWSLINE_VERSION:-0.
|
|
26
|
+
export NEWSLINE_VERSION="${NEWSLINE_VERSION:-1.0.0}"
|
|
27
27
|
LOCK="$CACHE_DIR/refresh.lock"
|
|
28
28
|
mkdir -p "$CACHE_DIR" 2>/dev/null
|
|
29
29
|
|
package/statusline.sh
CHANGED
|
@@ -24,6 +24,24 @@ if [ "$needs_refresh" = "1" ]; then
|
|
|
24
24
|
( "$HERE/refresh.sh" >/dev/null 2>&1 & ) 2>/dev/null
|
|
25
25
|
fi
|
|
26
26
|
|
|
27
|
+
# --- optional headline color (NEWSLINE_COLOR: a name, or raw SGR params) ---
|
|
28
|
+
# Applied at PRINT time, not baked into the cache, so `newsline color` shows up
|
|
29
|
+
# on the next status-line tick without waiting for a refresh.
|
|
30
|
+
SGR=""
|
|
31
|
+
case "$(printf '%s' "${NEWSLINE_COLOR:-}" | tr '[:upper:]' '[:lower:]')" in
|
|
32
|
+
''|default|none|off) SGR="" ;;
|
|
33
|
+
dim) SGR="2" ;;
|
|
34
|
+
gray|grey) SGR="90" ;;
|
|
35
|
+
red) SGR="31" ;; green) SGR="32" ;; yellow) SGR="33" ;;
|
|
36
|
+
blue) SGR="34" ;; magenta) SGR="35" ;; cyan) SGR="36" ;;
|
|
37
|
+
white) SGR="37" ;; orange) SGR="38;5;208" ;;
|
|
38
|
+
*[!0-9\;]*) SGR="" ;; # unknown name — ignore, print plain
|
|
39
|
+
*) SGR="${NEWSLINE_COLOR}" ;; # raw SGR params, e.g. "38;5;245"
|
|
40
|
+
esac
|
|
41
|
+
colorize() { # wrap text in the configured color (no-op when unset); no newline
|
|
42
|
+
if [ -n "$SGR" ]; then printf '\033[%sm%s\033[0m' "$SGR" "$1"; else printf '%s' "$1"; fi
|
|
43
|
+
}
|
|
44
|
+
|
|
27
45
|
# --- print one headline, rotating across the cached set by wall-clock time ---
|
|
28
46
|
# The cache holds N headlines (one per line). We show a different one every
|
|
29
47
|
# NEWSLINE_ROTATE seconds — a ticker feel with zero stored state.
|
|
@@ -35,12 +53,12 @@ if [ -s "$CACHE_FILE" ]; then
|
|
|
35
53
|
[ "$rot" -ge 1 ] || rot=6 # 0 would divide by zero below
|
|
36
54
|
now="${NEWSLINE_NOW:-$(date +%s)}" # NEWSLINE_NOW overrides clock (tests/debug)
|
|
37
55
|
idx=$(( (now / rot) % n + 1 ))
|
|
38
|
-
sed -n "${idx}p" "$CACHE_FILE"
|
|
56
|
+
colorize "$(sed -n "${idx}p" "$CACHE_FILE")"; printf '\n'
|
|
39
57
|
else
|
|
40
|
-
|
|
58
|
+
colorize '📰 …'
|
|
41
59
|
fi
|
|
42
60
|
else
|
|
43
|
-
|
|
61
|
+
colorize '📰 …' # first run, before the first refresh lands
|
|
44
62
|
fi
|
|
45
63
|
|
|
46
64
|
# --- server-driven update nudge (written/cleared by refresh.sh), below the news ---
|