DeadTOm :d20:
@deadtom@dice.camp
@deadtom@dice.camp
@deadtom@dice.camp
@deadtom@dice.camp
@deadtom@dice.camp
@nev@status.nevillepark.ca
Anyone on Android 15+ managed to ssh into a local Linux box from the native terminal app now in Android?
Once again, this is using the phone to ssh into a computer. Not the other way round.
I could easily ssh into my account on tty.sdf.org, but it just hangs forever when I try accessing my laptop. Got sshd running, but I've likely set something up wrong.
✅ 📱→ 💻
❌ 💻 → 📱
@fedify@hollo.social
Exciting news for #Fedify developers! We've just landed a major milestone for Fedify 2.0—the #CLI now runs natively on #Node.js and #Bun, not just #Deno (#456). If you install @fedify/cli@2.0.0-dev.1761 from npm, you'll get actual JavaScript that executes directly in your runtime, no more pre-compiled binaries from deno compile. This is part of our broader transition to Optique, a new cross-runtime CLI framework we've developed specifically for Fedify's needs (#374).
This change means a more natural development experience regardless of your #JavaScript runtime preference. Node.js developers can now run the CLI tools directly through their familiar ecosystem, and the same goes for Bun users. While Fedify 2.0 isn't released yet, we're excited to share this progress with the community—feel free to try out the dev version and let us know how it works for you!
@fedify@hollo.social
Exciting news for #Fedify developers! We've just landed a major milestone for Fedify 2.0—the #CLI now runs natively on #Node.js and #Bun, not just #Deno (#456). If you install @fedify/cli@2.0.0-dev.1761 from npm, you'll get actual JavaScript that executes directly in your runtime, no more pre-compiled binaries from deno compile. This is part of our broader transition to Optique, a new cross-runtime CLI framework we've developed specifically for Fedify's needs (#374).
This change means a more natural development experience regardless of your #JavaScript runtime preference. Node.js developers can now run the CLI tools directly through their familiar ecosystem, and the same goes for Bun users. While Fedify 2.0 isn't released yet, we're excited to share this progress with the community—feel free to try out the dev version and let us know how it works for you!
@fedify@hollo.social
Exciting news for #Fedify developers! We've just landed a major milestone for Fedify 2.0—the #CLI now runs natively on #Node.js and #Bun, not just #Deno (#456). If you install @fedify/cli@2.0.0-dev.1761 from npm, you'll get actual JavaScript that executes directly in your runtime, no more pre-compiled binaries from deno compile. This is part of our broader transition to Optique, a new cross-runtime CLI framework we've developed specifically for Fedify's needs (#374).
This change means a more natural development experience regardless of your #JavaScript runtime preference. Node.js developers can now run the CLI tools directly through their familiar ecosystem, and the same goes for Bun users. While Fedify 2.0 isn't released yet, we're excited to share this progress with the community—feel free to try out the dev version and let us know how it works for you!
@fedify@hollo.social
Exciting news for #Fedify developers! We've just landed a major milestone for Fedify 2.0—the #CLI now runs natively on #Node.js and #Bun, not just #Deno (#456). If you install @fedify/cli@2.0.0-dev.1761 from npm, you'll get actual JavaScript that executes directly in your runtime, no more pre-compiled binaries from deno compile. This is part of our broader transition to Optique, a new cross-runtime CLI framework we've developed specifically for Fedify's needs (#374).
This change means a more natural development experience regardless of your #JavaScript runtime preference. Node.js developers can now run the CLI tools directly through their familiar ecosystem, and the same goes for Bun users. While Fedify 2.0 isn't released yet, we're excited to share this progress with the community—feel free to try out the dev version and let us know how it works for you!
@fedify@hollo.social
Exciting news for #Fedify developers! We've just landed a major milestone for Fedify 2.0—the #CLI now runs natively on #Node.js and #Bun, not just #Deno (#456). If you install @fedify/cli@2.0.0-dev.1761 from npm, you'll get actual JavaScript that executes directly in your runtime, no more pre-compiled binaries from deno compile. This is part of our broader transition to Optique, a new cross-runtime CLI framework we've developed specifically for Fedify's needs (#374).
This change means a more natural development experience regardless of your #JavaScript runtime preference. Node.js developers can now run the CLI tools directly through their familiar ecosystem, and the same goes for Bun users. While Fedify 2.0 isn't released yet, we're excited to share this progress with the community—feel free to try out the dev version and let us know how it works for you!
@fedify@hollo.social
Exciting news for #Fedify developers! We've just landed a major milestone for Fedify 2.0—the #CLI now runs natively on #Node.js and #Bun, not just #Deno (#456). If you install @fedify/cli@2.0.0-dev.1761 from npm, you'll get actual JavaScript that executes directly in your runtime, no more pre-compiled binaries from deno compile. This is part of our broader transition to Optique, a new cross-runtime CLI framework we've developed specifically for Fedify's needs (#374).
This change means a more natural development experience regardless of your #JavaScript runtime preference. Node.js developers can now run the CLI tools directly through their familiar ecosystem, and the same goes for Bun users. While Fedify 2.0 isn't released yet, we're excited to share this progress with the community—feel free to try out the dev version and let us know how it works for you!
@fedify@hollo.social
Exciting news for #Fedify developers! We've just landed a major milestone for Fedify 2.0—the #CLI now runs natively on #Node.js and #Bun, not just #Deno (#456). If you install @fedify/cli@2.0.0-dev.1761 from npm, you'll get actual JavaScript that executes directly in your runtime, no more pre-compiled binaries from deno compile. This is part of our broader transition to Optique, a new cross-runtime CLI framework we've developed specifically for Fedify's needs (#374).
This change means a more natural development experience regardless of your #JavaScript runtime preference. Node.js developers can now run the CLI tools directly through their familiar ecosystem, and the same goes for Bun users. While Fedify 2.0 isn't released yet, we're excited to share this progress with the community—feel free to try out the dev version and let us know how it works for you!
@fedify@hollo.social
Exciting news for #Fedify developers! We've just landed a major milestone for Fedify 2.0—the #CLI now runs natively on #Node.js and #Bun, not just #Deno (#456). If you install @fedify/cli@2.0.0-dev.1761 from npm, you'll get actual JavaScript that executes directly in your runtime, no more pre-compiled binaries from deno compile. This is part of our broader transition to Optique, a new cross-runtime CLI framework we've developed specifically for Fedify's needs (#374).
This change means a more natural development experience regardless of your #JavaScript runtime preference. Node.js developers can now run the CLI tools directly through their familiar ecosystem, and the same goes for Bun users. While Fedify 2.0 isn't released yet, we're excited to share this progress with the community—feel free to try out the dev version and let us know how it works for you!
@fedify@hollo.social
Exciting news for #Fedify developers! We've just landed a major milestone for Fedify 2.0—the #CLI now runs natively on #Node.js and #Bun, not just #Deno (#456). If you install @fedify/cli@2.0.0-dev.1761 from npm, you'll get actual JavaScript that executes directly in your runtime, no more pre-compiled binaries from deno compile. This is part of our broader transition to Optique, a new cross-runtime CLI framework we've developed specifically for Fedify's needs (#374).
This change means a more natural development experience regardless of your #JavaScript runtime preference. Node.js developers can now run the CLI tools directly through their familiar ecosystem, and the same goes for Bun users. While Fedify 2.0 isn't released yet, we're excited to share this progress with the community—feel free to try out the dev version and let us know how it works for you!
@fedify@hollo.social
Exciting news for #Fedify developers! We've just landed a major milestone for Fedify 2.0—the #CLI now runs natively on #Node.js and #Bun, not just #Deno (#456). If you install @fedify/cli@2.0.0-dev.1761 from npm, you'll get actual JavaScript that executes directly in your runtime, no more pre-compiled binaries from deno compile. This is part of our broader transition to Optique, a new cross-runtime CLI framework we've developed specifically for Fedify's needs (#374).
This change means a more natural development experience regardless of your #JavaScript runtime preference. Node.js developers can now run the CLI tools directly through their familiar ecosystem, and the same goes for Bun users. While Fedify 2.0 isn't released yet, we're excited to share this progress with the community—feel free to try out the dev version and let us know how it works for you!
@fedify@hollo.social
Exciting news for #Fedify developers! We've just landed a major milestone for Fedify 2.0—the #CLI now runs natively on #Node.js and #Bun, not just #Deno (#456). If you install @fedify/cli@2.0.0-dev.1761 from npm, you'll get actual JavaScript that executes directly in your runtime, no more pre-compiled binaries from deno compile. This is part of our broader transition to Optique, a new cross-runtime CLI framework we've developed specifically for Fedify's needs (#374).
This change means a more natural development experience regardless of your #JavaScript runtime preference. Node.js developers can now run the CLI tools directly through their familiar ecosystem, and the same goes for Bun users. While Fedify 2.0 isn't released yet, we're excited to share this progress with the community—feel free to try out the dev version and let us know how it works for you!
@fedify@hollo.social
Exciting news for #Fedify developers! We've just landed a major milestone for Fedify 2.0—the #CLI now runs natively on #Node.js and #Bun, not just #Deno (#456). If you install @fedify/cli@2.0.0-dev.1761 from npm, you'll get actual JavaScript that executes directly in your runtime, no more pre-compiled binaries from deno compile. This is part of our broader transition to Optique, a new cross-runtime CLI framework we've developed specifically for Fedify's needs (#374).
This change means a more natural development experience regardless of your #JavaScript runtime preference. Node.js developers can now run the CLI tools directly through their familiar ecosystem, and the same goes for Bun users. While Fedify 2.0 isn't released yet, we're excited to share this progress with the community—feel free to try out the dev version and let us know how it works for you!
@fedify@hollo.social
Exciting news for #Fedify developers! We've just landed a major milestone for Fedify 2.0—the #CLI now runs natively on #Node.js and #Bun, not just #Deno (#456). If you install @fedify/cli@2.0.0-dev.1761 from npm, you'll get actual JavaScript that executes directly in your runtime, no more pre-compiled binaries from deno compile. This is part of our broader transition to Optique, a new cross-runtime CLI framework we've developed specifically for Fedify's needs (#374).
This change means a more natural development experience regardless of your #JavaScript runtime preference. Node.js developers can now run the CLI tools directly through their familiar ecosystem, and the same goes for Bun users. While Fedify 2.0 isn't released yet, we're excited to share this progress with the community—feel free to try out the dev version and let us know how it works for you!
@widehyo@hackers.pub
요새 awk에 대해 많은 관심을 가지고 있다. 특히 awk는 기본적으로 제공되는 feature가 가장 적은 언어중에 하나이기 때문에 다른 언어에서 편하게 사용했던 편의 기능을 직접 구현해서 사용해야 하는 경우가 많다. 하지만 awk 특유의 script스러움과 여러 편의기능 및 문법은 이에 익숙해진 사용자에게 빠져나가기 힘든 매력을 지니고 있기도 하다.
서론은 여기까지 하고 상당히 복잡한 구현이었던 functools.partial을 awk로 구현한 내용을 자세히 살펴보자.
먼저, awk에 대한 이해를 돕기 위해 언어가 가진 제약사항을 먼저 언급하고 가자.
(void *)를 이용한 함수 객체 활용이 불가하다.위의 제약사항 중 3, 4, 5, 6번은 C언어가 가진 제약사항을 고려하면 이해가 된다. 그러나 1번과 2번, 그리고 7번은 C언어 보다도 강력한 제약사항이라고 볼 수 있다. 그나마 7번은 gawk(GNU awk) 5.1 버전에서는 functionName = "myfunc"; @functionName을 이용하여 간접호출은 가능하다. 하지만 함수를 반환하거나, 변수에 함수를 할당하거나 파라미터에 함수를 넘기는 것은 불가능하다. 8번의 경우는 그나마 C언어의 함수 스코프가 지원되는 것을 이용하면 함수 내에서 지역변수 취급하고 싶은 변수를 parameter 자리에 넣음으로써 지역변수 취급이 가능하다.
그리고 이를 극복하기 위한 대응방안은 다음과 같다.
1번과 2번의 사용자정의 자료형 문제는 자료형을 표현할 수 있는 문자열을 설계(serialization과 같은 전략)하여 전달하다가 필요한 시점에 해당 문자열을 다시 원하는 형태로 복원하는 방법으로 극복할 수 있다. 이 전략은 posix awk가 multi dimensional array를 지원하지 않는 것에 대한 대응방안으로 a[i][j] 대신 a[i, j]로 사용한 점에서 착안했다. 편의를 위한 배열 인덱스 자리에 위치하는 i, j는 사실 "i\034j" 문자와 같다. 배열의 index에 위치하는 ,는 키보드로 입력 불가능한 문자인 "\034"로 치환되며, awk에서의 강력한 사용성을 지원하기 위해 내장변수 SUBSEP으로 \034 문자를 사용할 수 있다.
3번과 4번의 경우는 함수형 프로그래밍 방식을 선호하는 필자에게는 많은 불편함을 가져다 주었고, 이번 포스팅의 주된 도전과제였다. 간략히 극복전략을 이야기하자면 global table(associative array)를 이용하여 storage에 원하는 내용을 넣었다가 사용하는 방식으로 극복하였다.
5번과 6번은 생각보다 극복 난이도가 낮았는데, C언어의 call by reference 방식으로 우회하면 된다. C언어에서 array를 sort하기 위해 배열의 포인터를 함수에 넘기고 안에서 swap한 것과 근본적으로 같은 방식이다. 한편, multi return을 위해 새로운 배열을 만들어 return하고 싶을 때는 해당 배열을 parameter로 넘기고 함수 본문 시작시 delete 문을 이용해 우연히 같은 이름을 사용하는 global variable 문제를 방지하였다. 그리고 이 방법은 awk의 기본 함수인 split("text", "array", "separator")에서 자연스럽게 사용하는 방법이기 때문에 awk의 idiom과도 부합한다.
7번은 gawk의 힘을 빌려 @fn 을 이용한다. man awk를 읽다가 @fn을 보고 이거 잘하면 함수형 프로그래밍 할 수 있겠는데 라는 생각이 이 글의 근본적인 모티베이션이 되었다. 하지만 10번의 제약사항에 의하여 런타임에서 dynamic하게 함수/매개변수에 접근할 수 없었기 때문에 debugger가 참조하는 프레임 객체와 비슷한 것 중 functools.partial에서 필요한 정보만 담은 global variable을 직접 만들어 구현했다.
가장 먼저 진행한 부분은 함수 signature를 저장하는 방법을 찾는 것이었다. functools.partial과 같은 함수는 parameter의 위치 및 key를 이용하여 default parameter를 binding할 수 있었기 때문에 해당하는 정보를 저장해야 했다. 결론만 말하자면 다음과 같은 함수가 있을 때
function sample(a, b, c) { ... }
[(a, 1), (b, 2), (c, 3)] 과 같은 형태로 함수의 signature가 저장되기를 원했다. 하지만 array는 element로 array를 가질 수 없기에(array의 원소에 array를 할당하려 하면 syntax error), [(a, 1), (b, 2), (c, 3)]의 string representation을 다음과 같이 저장했다.
SSEP = "\035"
"1" SUBSEP "a" SSEP "2" SUBSEP "b" SSEP "3" SUBSEP "c"
구분자가 2개가 필요했는데 하나는 튜플 안에서 데이터를 구분하는 구분자로 사용된 SUBSEP, 그리고 리스트에서 각 튜플의 구분자로 사용된 SSEP이다. 이렇게 function signature를 string으로 표현하여 global variable인 FUNCSIG 테이블에 함수명을 키로, function signature의 string repr을 value로 저장한다. 그러면 대충 python으로 보면 이런 느낌이 된다.
FUNCSIG["sample"] = "1\034a\0352\034b\0353\034c"
그리고 실제로 사용할 때는 SSEP과 SUBSEP으로 split하여(deserialize하여) {"a":1,"b":2,"c":3} 과 같은 형태로 사용한다.
# save function signature to global variable FUNCSIG
# argument information is of form list of tuples (position, parameter name)
# list element delemter: SSEP, key-value delemeter: SUBSEP
function saveSignature(fnname, argInfo) {
posRepr = bindPosition(argInfo)
FUNCSIG[fnname] = posRepr
}
function bindPosition(array, acc) {
for (i = 1; i <= length(array); i++) {
acc = acc i SUBSEP array[i] SSEP
}
return substr(acc, 1, length(acc) - 1)
}
두번째로는 진행한 함수는 binding된 함수를 만드는 함수이다. functools의 partial이 하는 역할과 같다고 보면 된다.
원본함수명(fnname)과 default parameter의 정보(bindings)를 받아 원본 함수의
parameter 중 명시적으로 호출하지 않은 매개변수는 bindings로 미리 정의한 매개변수를
사용하는 함수의 이름을 key로 등록하는 동작을 awk용으로 바꾼 것이다.
>>> from functools import partial
>>> def fnname(a, b):
... print(f"a: {a}, b: {b}")
...
>>> key = partial(fnname, b=3)
>>> key(1)
a: 1, b: 3
function fnname(a, b) {
printf "a: %s, b: %s", a, b
}
# 정의부
key = "partial_fn"
bind(key, "fnname", "b" SUBSEP "3") # partial_fn = partial(fnname, b=3)과 같은 역할
# 사용부
call(key, "a" SUBSEP "1") # partial_fn(a=1)과 같은 역할 == @key(a=1)과 같은 역할
매개변수는 argument를 binding하는 정보를 담고 있는 array(bindings)와 원본 함수명(fnname) 그리고 binding한 함수명(key)으로 구성된다.
함수명을 통한 함수 간접호출은 gawk에서 @fn 문법으로 가능하기 때문에, 어떤 함수에 어떤 parameter가 바인딩 되었는지를 정보로 전달하고 binding된 새로운 함수를 key로 global variable BINDING이 가지고 있다가 call 함수에 의해 해당 정보를 찾아 reconstruction을 통해 호출하는 방법이다. 최대한의 유연성을 확보하기 위하여 bindings는 associative array로 설계했고, 위에서 저장한 function signature와 실제 실행 책임을 가진 함수 call에서 호출할 args와 함께 사용된다.
binding한 정보는 [원본함수명] [(매개변수1, 값1), (매개변수2, 값2), ...] 와 같은 형태로 저장된다. 물론, awk에는 string과 number만 primitive type으로 가지므로 string representation 형태로 저장한다.
# save binding arguments to global variable BINDING
# key will be used as partial function(default parameter from binding info)
# the form value consists two parts, head and tails separated with first SSEP
# head contains `original function name`
# tail is of form string representation of the list of tuple, which argName SUBSEP value
# each elements is joined with SSEP
function bind(key, fnname, bindings, argRepr) {
argRepr = fnname SSEP
if (length(bindings) == 0) {
BINDING[key] = argRepr
return
}
argRepr = argRepr serializeAssoc(bindings)
BINDING[key] = argRepr
}
헬퍼 함수 serializeAssoc을 사용했다.
function serializeAssoc(assoc, acc) {
for (key in assoc) {
acc = acc key SUBSEP assoc[key] SSEP
}
return substr(acc, 1, length(acc) - 1)
}
위에서 만든 바인딩된 함수를 호출하는 함수 call이다. 실제 함수호출을 담당하고 내부로직이 가장 복잡한 함수이다. function signature는 다음과 같다.
function call(key, args, bindings)
위에서 정의한 key로 BINDING에서 argRepr을 가져온다. argRepr의 첫 번째 위치에 있는 함수명을 추출한다 추출한 함수명으로 FUNCSIG에 저장된 posRepr를 가져온다.
argRepr의 두 번째 위치에 있는 binding 정보를 복원하고 원본함수의 function signature를 담고 있는 posRepr을 각각 복원하여, 실제로 호출할 args와 결합하여 호출한다.
전반부는 실제 파라미터를 생성하는 부분으로 구성된다.
function call(key, args, bindings) {
if (!BINDING[key]) {
print "unregistered function call"
return
}
buildParameter(key, args, params)
buildParameter 함수는 바인딩된 함수를 호출할 args를 우선적으로 적용하고 args에서 채워지지 않은 매개변수는 bindingRepr에서 표현된 매개변수 정보에서 채워넣는다. 만약 모든 parameter가 채워지지 않았다면 에러를 출력한다. multi return을 위하여 params 배열을 이용한다.
function buildParameter(key, args, params) {
partition(BINDING[key], SSEP, fnBinding)
fnname = fnBinding[1]
inspectParams(fnname, paramDict)
bindingRepr = fnBinding[2]
bindingRepr2Dict(bindingRepr, bindingDict)
for (idx in args) {
params[idx] = args[idx]
}
for (idx in paramDict) {
if (!params[paramDict[idx]]) {
params[paramDict[idx]] = bindingDict[idx]
}
}
if (length(paramDict) != length(params)) {
print "invalid execution, mismatch between original function and binded function"
delete params
}
}
partition은 헬퍼함수이다. separator를 기준으로 전후를 잘라낸다. 역시 multi return이 필요하기 때문에 headtail 매개변수 배열을 이용한다.
function partition(str, sep, headtail) {
headtail[1] = substr(str, 1, index(str, sep) - length(sep))
headtail[2] = substr(str, index(str, sep) + length(sep))
}
bindingRepr2Dict는 string representation을 dictionary(associative array)로 복원하는 함수이다. 내용이 간단하므로 먼저 소개한다. BINDING global 변수와 관련있다.
function bindingRepr2Dict(repr, bindingDict, tmp) {
split(repr, tmp, SSEP)
for (idx in tmp) {
split(tmp[idx], keyVal, SUBSEP)
bindingDict[keyVal[1]] = keyVal[2]
}
}
inspectParams는 원본 함수의 function signature를 담고 있는 FUNCSIG global 변수와 관련있다.
function inspectParams(fnname, paramDict) {
posRepr = FUNCSIG[fnname]
posRepr2Dict(posRepr, paramDict)
}
function posRepr2Dict(posRepr, paramDict, tmp, posNameTuple) {
split(posRepr, tmp, SSEP)
for (idx in tmp) {
split(tmp[idx], posName, SUBSEP)
paramDict[posName[2]] = posName[1]
}
}
아래 부분이 비즈니스 로직으로, 명시적으로 호출하는 매개변수를 이용해 원본 함수의 funciton signature를 최대한 채워 넣은 후 비어있는 매개변수에 대하여 bindingDict에서 정의되어 있다면 나머지를 채워 넣는 식으로 작동한다.
for (idx in args) {
params[idx] = args[idx]
}
for (idx in paramDict) {
if (!params[paramDict[idx]]) {
params[paramDict[idx]] = bindingDict[idx]
}
}
물론, 명시적으로 주어진 parameter와 binding된 매개변수 모두 사용해도 함수가 요구하는 매개변수를 모두 채우지 못한다면 에러메시지를 출력한다.
if (length(paramDict) != length(params)) {
print "invalid execution, mismatch between original function and binded function"
delete params
}
사실 위의 코드에서는 exit로 나가도 좋다
이렇게 parameter를 구성하면 남은 작업은 간단하다. 매개변수의 개수에 따라 해당하는 함수를 동적으로 호출하는 부분만 남았다. call 함수의 후반부 코드를 보자.
switch (length(params)) {
case 1:
executeFunc1(fnname, params)
break
case 2:
executeFunc2(fnname, params)
break
case 3:
executeFunc3(fnname, params)
break
case 4:
executeFunc4(fnname, params)
break
default:
print "#(function params) must one of 1, 2, 3, or 4"
return
}
여러 helper 함수를 사용하는데, 이것은 awk가 동적 프로그래밍이 불가능하기 때문이다. 쉽게 말하면 eval이 없어서 각종 템플릿에 맞는 함수를 하나씩 사전에 정의해 두어야 한다.
function executeFunc1(fnname, params) {
@fnname(params[1])
}
function executeFunc2(fnname, params) {
@fnname(params[1], params[2])
}
function executeFunc3(fnname, params) {
@fnname(params[1], params[2], params[3])
}
function executeFunc4(fnname, params) {
@fnname(params[1], params[2], params[3], params[4])
}
이상을 모두 적용한 전체 코드는 다음과 같다.
function sample(a, b, c) {
printf "a: %s, b: %s, c: %s\n", a, b, c
}
# save binding arguments to global variable BINDING
# key will be used as partial function(default parameter from binding info)
# the form value consists two parts, head and tails separated with first SSEP
# head contains `original function name`
# tail is of form string representation of the list of tuple, which argName SUBSEP value
# each elements is joined with SSEP
function bind(key, fnname, bindings, argRepr) {
argRepr = fnname SSEP
if (length(bindings) == 0) {
BINDING[key] = argRepr
return
}
argRepr = argRepr serializeAssoc(bindings)
BINDING[key] = argRepr
}
function serializeAssoc(assoc, acc) {
for (key in assoc) {
acc = acc key SUBSEP assoc[key] SSEP
}
return substr(acc, 1, length(acc) - 1)
}
function bindPosition(array, acc) {
for (i = 1; i <= length(array); i++) {
acc = acc i SUBSEP array[i] SSEP
}
return substr(acc, 1, length(acc) - 1)
}
function flip(assoc) {
for (idx in assoc) {
assoc[assoc[idx]] = idx
}
}
function printArray(arr, arrName) {
for (idx in arr) {
printf "%s[%s]: %s\n", (arrName ? arrName : "arr"), idx, arr[idx]
}
}
function apply(arr, fn) {
for (idx in arr) {
arr[idx] = @fn(arr[idx])
}
}
function strReprArr2dict(strReprArr, dict, strRepr) {
delete dict
for (i = 1; i <= length(strReprArr); i++) {
strRepr = strReprArr[i]
partition(strRepr, SUBSEP, headtail)
dict[headtail[1]] = headtail[2]
}
}
function partition(str, sep, headtail) {
headtail[1] = substr(str, 1, index(str, sep) - length(sep))
headtail[2] = substr(str, index(str, sep) + length(sep))
}
function call(key, args, bindings) {
if (!BINDING[key]) {
print "unregistered function call"
return
}
buildParameter(key, args, params)
switch (length(params)) {
case 1:
executeFunc1(fnname, params)
break
case 2:
executeFunc2(fnname, params)
break
case 3:
executeFunc3(fnname, params)
break
case 4:
executeFunc4(fnname, params)
break
default:
print "#(function params) must one of 1, 2, 3, or 4"
return
}
}
function buildParameter(key, args, params) {
partition(BINDING[key], SSEP, fnBinding)
fnname = fnBinding[1]
inspectParams(fnname, paramDict)
bindingRepr = fnBinding[2]
bindingRepr2Dict(bindingRepr, bindingDict)
for (idx in args) {
params[idx] = args[idx]
}
for (idx in paramDict) {
if (!params[paramDict[idx]]) {
params[paramDict[idx]] = bindingDict[idx]
}
}
if (length(paramDict) != length(params)) {
print "invalid execution, mismatch between original function and binded function"
delete params
}
}
function bindingRepr2Dict(repr, bindingDict, tmp) {
split(repr, tmp, SSEP)
for (idx in tmp) {
split(tmp[idx], keyVal, SUBSEP)
bindingDict[keyVal[1]] = keyVal[2]
}
}
function inspectParams(fnname, paramDict) {
posRepr = FUNCSIG[fnname]
posRepr2Dict(posRepr, paramDict)
}
function posRepr2Dict(posRepr, paramDict, tmp, posNameTuple) {
split(posRepr, tmp, SSEP)
for (idx in tmp) {
split(tmp[idx], posName, SUBSEP)
paramDict[posName[2]] = posName[1]
}
}
function executeFunc1(fnname, params) {
@fnname(params[1])
}
function executeFunc2(fnname, params) {
@fnname(params[1], params[2])
}
function executeFunc3(fnname, params) {
@fnname(params[1], params[2], params[3])
}
function executeFunc4(fnname, params) {
@fnname(params[1], params[2], params[3], params[4])
}
# save function signature to global variable FUNCSIG
# argument information is of form list of tuples (position, parameter name)
# list element delemter: SSEP, key-value delemeter: SUBSEP
function saveSignature(fnname, argInfo) {
posRepr = bindPosition(argInfo)
FUNCSIG[fnname] = posRepr
}
function zip(arr1, arr2, dict) {
minlen = (length(arr1) < length(arr2) ? length(arr1) : length(arr2))
for (i = 1; i <= minlen; i++) {
dict[arr1[i]] = arr2[i]
}
}
BEGIN {
SSEP = "\035"
split("a b c", arginfo)
saveSignature("sample", arginfo)
split("b c", keys)
split("5678 asdf", vals)
zip(keys, vals, bindings)
bind("partial", "sample", bindings)
split("1", args)
call("partial", args)
}
적절한 라이브러리에 분리하고 import를 사용하면 다음과 같다.
@include "common"
@include "functool"
function sample(a, b, c) {
printf "a: %s, b: %s, c: %s\n", a, b, c
}
BEGIN {
SSEP = "\035"
split("a b c", arginfo)
saveSignature("sample", arginfo)
split("b c", keys)
split("5678 asdf", vals)
zip(keys, vals, bindings)
bind("partial", "sample", bindings)
split("1", args)
call("partial", args)
}
출력 결과는 아래와 같다.
a: 1, b: 5678, c: asdf
@widehyo@hackers.pub
요새 awk에 대해 많은 관심을 가지고 있다. 특히 awk는 기본적으로 제공되는 feature가 가장 적은 언어중에 하나이기 때문에 다른 언어에서 편하게 사용했던 편의 기능을 직접 구현해서 사용해야 하는 경우가 많다. 하지만 awk 특유의 script스러움과 여러 편의기능 및 문법은 이에 익숙해진 사용자에게 빠져나가기 힘든 매력을 지니고 있기도 하다.
서론은 여기까지 하고 상당히 복잡한 구현이었던 functools.partial을 awk로 구현한 내용을 자세히 살펴보자.
먼저, awk에 대한 이해를 돕기 위해 언어가 가진 제약사항을 먼저 언급하고 가자.
(void *)를 이용한 함수 객체 활용이 불가하다.위의 제약사항 중 3, 4, 5, 6번은 C언어가 가진 제약사항을 고려하면 이해가 된다. 그러나 1번과 2번, 그리고 7번은 C언어 보다도 강력한 제약사항이라고 볼 수 있다. 그나마 7번은 gawk(GNU awk) 5.1 버전에서는 functionName = "myfunc"; @functionName을 이용하여 간접호출은 가능하다. 하지만 함수를 반환하거나, 변수에 함수를 할당하거나 파라미터에 함수를 넘기는 것은 불가능하다. 8번의 경우는 그나마 C언어의 함수 스코프가 지원되는 것을 이용하면 함수 내에서 지역변수 취급하고 싶은 변수를 parameter 자리에 넣음으로써 지역변수 취급이 가능하다.
그리고 이를 극복하기 위한 대응방안은 다음과 같다.
1번과 2번의 사용자정의 자료형 문제는 자료형을 표현할 수 있는 문자열을 설계(serialization과 같은 전략)하여 전달하다가 필요한 시점에 해당 문자열을 다시 원하는 형태로 복원하는 방법으로 극복할 수 있다. 이 전략은 posix awk가 multi dimensional array를 지원하지 않는 것에 대한 대응방안으로 a[i][j] 대신 a[i, j]로 사용한 점에서 착안했다. 편의를 위한 배열 인덱스 자리에 위치하는 i, j는 사실 "i\034j" 문자와 같다. 배열의 index에 위치하는 ,는 키보드로 입력 불가능한 문자인 "\034"로 치환되며, awk에서의 강력한 사용성을 지원하기 위해 내장변수 SUBSEP으로 \034 문자를 사용할 수 있다.
3번과 4번의 경우는 함수형 프로그래밍 방식을 선호하는 필자에게는 많은 불편함을 가져다 주었고, 이번 포스팅의 주된 도전과제였다. 간략히 극복전략을 이야기하자면 global table(associative array)를 이용하여 storage에 원하는 내용을 넣었다가 사용하는 방식으로 극복하였다.
5번과 6번은 생각보다 극복 난이도가 낮았는데, C언어의 call by reference 방식으로 우회하면 된다. C언어에서 array를 sort하기 위해 배열의 포인터를 함수에 넘기고 안에서 swap한 것과 근본적으로 같은 방식이다. 한편, multi return을 위해 새로운 배열을 만들어 return하고 싶을 때는 해당 배열을 parameter로 넘기고 함수 본문 시작시 delete 문을 이용해 우연히 같은 이름을 사용하는 global variable 문제를 방지하였다. 그리고 이 방법은 awk의 기본 함수인 split("text", "array", "separator")에서 자연스럽게 사용하는 방법이기 때문에 awk의 idiom과도 부합한다.
7번은 gawk의 힘을 빌려 @fn 을 이용한다. man awk를 읽다가 @fn을 보고 이거 잘하면 함수형 프로그래밍 할 수 있겠는데 라는 생각이 이 글의 근본적인 모티베이션이 되었다. 하지만 10번의 제약사항에 의하여 런타임에서 dynamic하게 함수/매개변수에 접근할 수 없었기 때문에 debugger가 참조하는 프레임 객체와 비슷한 것 중 functools.partial에서 필요한 정보만 담은 global variable을 직접 만들어 구현했다.
가장 먼저 진행한 부분은 함수 signature를 저장하는 방법을 찾는 것이었다. functools.partial과 같은 함수는 parameter의 위치 및 key를 이용하여 default parameter를 binding할 수 있었기 때문에 해당하는 정보를 저장해야 했다. 결론만 말하자면 다음과 같은 함수가 있을 때
function sample(a, b, c) { ... }
[(a, 1), (b, 2), (c, 3)] 과 같은 형태로 함수의 signature가 저장되기를 원했다. 하지만 array는 element로 array를 가질 수 없기에(array의 원소에 array를 할당하려 하면 syntax error), [(a, 1), (b, 2), (c, 3)]의 string representation을 다음과 같이 저장했다.
SSEP = "\035"
"1" SUBSEP "a" SSEP "2" SUBSEP "b" SSEP "3" SUBSEP "c"
구분자가 2개가 필요했는데 하나는 튜플 안에서 데이터를 구분하는 구분자로 사용된 SUBSEP, 그리고 리스트에서 각 튜플의 구분자로 사용된 SSEP이다. 이렇게 function signature를 string으로 표현하여 global variable인 FUNCSIG 테이블에 함수명을 키로, function signature의 string repr을 value로 저장한다. 그러면 대충 python으로 보면 이런 느낌이 된다.
FUNCSIG["sample"] = "1\034a\0352\034b\0353\034c"
그리고 실제로 사용할 때는 SSEP과 SUBSEP으로 split하여(deserialize하여) {"a":1,"b":2,"c":3} 과 같은 형태로 사용한다.
# save function signature to global variable FUNCSIG
# argument information is of form list of tuples (position, parameter name)
# list element delemter: SSEP, key-value delemeter: SUBSEP
function saveSignature(fnname, argInfo) {
posRepr = bindPosition(argInfo)
FUNCSIG[fnname] = posRepr
}
function bindPosition(array, acc) {
for (i = 1; i <= length(array); i++) {
acc = acc i SUBSEP array[i] SSEP
}
return substr(acc, 1, length(acc) - 1)
}
두번째로는 진행한 함수는 binding된 함수를 만드는 함수이다. functools의 partial이 하는 역할과 같다고 보면 된다.
원본함수명(fnname)과 default parameter의 정보(bindings)를 받아 원본 함수의
parameter 중 명시적으로 호출하지 않은 매개변수는 bindings로 미리 정의한 매개변수를
사용하는 함수의 이름을 key로 등록하는 동작을 awk용으로 바꾼 것이다.
>>> from functools import partial
>>> def fnname(a, b):
... print(f"a: {a}, b: {b}")
...
>>> key = partial(fnname, b=3)
>>> key(1)
a: 1, b: 3
function fnname(a, b) {
printf "a: %s, b: %s", a, b
}
# 정의부
key = "partial_fn"
bind(key, "fnname", "b" SUBSEP "3") # partial_fn = partial(fnname, b=3)과 같은 역할
# 사용부
call(key, "a" SUBSEP "1") # partial_fn(a=1)과 같은 역할 == @key(a=1)과 같은 역할
매개변수는 argument를 binding하는 정보를 담고 있는 array(bindings)와 원본 함수명(fnname) 그리고 binding한 함수명(key)으로 구성된다.
함수명을 통한 함수 간접호출은 gawk에서 @fn 문법으로 가능하기 때문에, 어떤 함수에 어떤 parameter가 바인딩 되었는지를 정보로 전달하고 binding된 새로운 함수를 key로 global variable BINDING이 가지고 있다가 call 함수에 의해 해당 정보를 찾아 reconstruction을 통해 호출하는 방법이다. 최대한의 유연성을 확보하기 위하여 bindings는 associative array로 설계했고, 위에서 저장한 function signature와 실제 실행 책임을 가진 함수 call에서 호출할 args와 함께 사용된다.
binding한 정보는 [원본함수명] [(매개변수1, 값1), (매개변수2, 값2), ...] 와 같은 형태로 저장된다. 물론, awk에는 string과 number만 primitive type으로 가지므로 string representation 형태로 저장한다.
# save binding arguments to global variable BINDING
# key will be used as partial function(default parameter from binding info)
# the form value consists two parts, head and tails separated with first SSEP
# head contains `original function name`
# tail is of form string representation of the list of tuple, which argName SUBSEP value
# each elements is joined with SSEP
function bind(key, fnname, bindings, argRepr) {
argRepr = fnname SSEP
if (length(bindings) == 0) {
BINDING[key] = argRepr
return
}
argRepr = argRepr serializeAssoc(bindings)
BINDING[key] = argRepr
}
헬퍼 함수 serializeAssoc을 사용했다.
function serializeAssoc(assoc, acc) {
for (key in assoc) {
acc = acc key SUBSEP assoc[key] SSEP
}
return substr(acc, 1, length(acc) - 1)
}
위에서 만든 바인딩된 함수를 호출하는 함수 call이다. 실제 함수호출을 담당하고 내부로직이 가장 복잡한 함수이다. function signature는 다음과 같다.
function call(key, args, bindings)
위에서 정의한 key로 BINDING에서 argRepr을 가져온다. argRepr의 첫 번째 위치에 있는 함수명을 추출한다 추출한 함수명으로 FUNCSIG에 저장된 posRepr를 가져온다.
argRepr의 두 번째 위치에 있는 binding 정보를 복원하고 원본함수의 function signature를 담고 있는 posRepr을 각각 복원하여, 실제로 호출할 args와 결합하여 호출한다.
전반부는 실제 파라미터를 생성하는 부분으로 구성된다.
function call(key, args, bindings) {
if (!BINDING[key]) {
print "unregistered function call"
return
}
buildParameter(key, args, params)
buildParameter 함수는 바인딩된 함수를 호출할 args를 우선적으로 적용하고 args에서 채워지지 않은 매개변수는 bindingRepr에서 표현된 매개변수 정보에서 채워넣는다. 만약 모든 parameter가 채워지지 않았다면 에러를 출력한다. multi return을 위하여 params 배열을 이용한다.
function buildParameter(key, args, params) {
partition(BINDING[key], SSEP, fnBinding)
fnname = fnBinding[1]
inspectParams(fnname, paramDict)
bindingRepr = fnBinding[2]
bindingRepr2Dict(bindingRepr, bindingDict)
for (idx in args) {
params[idx] = args[idx]
}
for (idx in paramDict) {
if (!params[paramDict[idx]]) {
params[paramDict[idx]] = bindingDict[idx]
}
}
if (length(paramDict) != length(params)) {
print "invalid execution, mismatch between original function and binded function"
delete params
}
}
partition은 헬퍼함수이다. separator를 기준으로 전후를 잘라낸다. 역시 multi return이 필요하기 때문에 headtail 매개변수 배열을 이용한다.
function partition(str, sep, headtail) {
headtail[1] = substr(str, 1, index(str, sep) - length(sep))
headtail[2] = substr(str, index(str, sep) + length(sep))
}
bindingRepr2Dict는 string representation을 dictionary(associative array)로 복원하는 함수이다. 내용이 간단하므로 먼저 소개한다. BINDING global 변수와 관련있다.
function bindingRepr2Dict(repr, bindingDict, tmp) {
split(repr, tmp, SSEP)
for (idx in tmp) {
split(tmp[idx], keyVal, SUBSEP)
bindingDict[keyVal[1]] = keyVal[2]
}
}
inspectParams는 원본 함수의 function signature를 담고 있는 FUNCSIG global 변수와 관련있다.
function inspectParams(fnname, paramDict) {
posRepr = FUNCSIG[fnname]
posRepr2Dict(posRepr, paramDict)
}
function posRepr2Dict(posRepr, paramDict, tmp, posNameTuple) {
split(posRepr, tmp, SSEP)
for (idx in tmp) {
split(tmp[idx], posName, SUBSEP)
paramDict[posName[2]] = posName[1]
}
}
아래 부분이 비즈니스 로직으로, 명시적으로 호출하는 매개변수를 이용해 원본 함수의 funciton signature를 최대한 채워 넣은 후 비어있는 매개변수에 대하여 bindingDict에서 정의되어 있다면 나머지를 채워 넣는 식으로 작동한다.
for (idx in args) {
params[idx] = args[idx]
}
for (idx in paramDict) {
if (!params[paramDict[idx]]) {
params[paramDict[idx]] = bindingDict[idx]
}
}
물론, 명시적으로 주어진 parameter와 binding된 매개변수 모두 사용해도 함수가 요구하는 매개변수를 모두 채우지 못한다면 에러메시지를 출력한다.
if (length(paramDict) != length(params)) {
print "invalid execution, mismatch between original function and binded function"
delete params
}
사실 위의 코드에서는 exit로 나가도 좋다
이렇게 parameter를 구성하면 남은 작업은 간단하다. 매개변수의 개수에 따라 해당하는 함수를 동적으로 호출하는 부분만 남았다. call 함수의 후반부 코드를 보자.
switch (length(params)) {
case 1:
executeFunc1(fnname, params)
break
case 2:
executeFunc2(fnname, params)
break
case 3:
executeFunc3(fnname, params)
break
case 4:
executeFunc4(fnname, params)
break
default:
print "#(function params) must one of 1, 2, 3, or 4"
return
}
여러 helper 함수를 사용하는데, 이것은 awk가 동적 프로그래밍이 불가능하기 때문이다. 쉽게 말하면 eval이 없어서 각종 템플릿에 맞는 함수를 하나씩 사전에 정의해 두어야 한다.
function executeFunc1(fnname, params) {
@fnname(params[1])
}
function executeFunc2(fnname, params) {
@fnname(params[1], params[2])
}
function executeFunc3(fnname, params) {
@fnname(params[1], params[2], params[3])
}
function executeFunc4(fnname, params) {
@fnname(params[1], params[2], params[3], params[4])
}
이상을 모두 적용한 전체 코드는 다음과 같다.
function sample(a, b, c) {
printf "a: %s, b: %s, c: %s\n", a, b, c
}
# save binding arguments to global variable BINDING
# key will be used as partial function(default parameter from binding info)
# the form value consists two parts, head and tails separated with first SSEP
# head contains `original function name`
# tail is of form string representation of the list of tuple, which argName SUBSEP value
# each elements is joined with SSEP
function bind(key, fnname, bindings, argRepr) {
argRepr = fnname SSEP
if (length(bindings) == 0) {
BINDING[key] = argRepr
return
}
argRepr = argRepr serializeAssoc(bindings)
BINDING[key] = argRepr
}
function serializeAssoc(assoc, acc) {
for (key in assoc) {
acc = acc key SUBSEP assoc[key] SSEP
}
return substr(acc, 1, length(acc) - 1)
}
function bindPosition(array, acc) {
for (i = 1; i <= length(array); i++) {
acc = acc i SUBSEP array[i] SSEP
}
return substr(acc, 1, length(acc) - 1)
}
function flip(assoc) {
for (idx in assoc) {
assoc[assoc[idx]] = idx
}
}
function printArray(arr, arrName) {
for (idx in arr) {
printf "%s[%s]: %s\n", (arrName ? arrName : "arr"), idx, arr[idx]
}
}
function apply(arr, fn) {
for (idx in arr) {
arr[idx] = @fn(arr[idx])
}
}
function strReprArr2dict(strReprArr, dict, strRepr) {
delete dict
for (i = 1; i <= length(strReprArr); i++) {
strRepr = strReprArr[i]
partition(strRepr, SUBSEP, headtail)
dict[headtail[1]] = headtail[2]
}
}
function partition(str, sep, headtail) {
headtail[1] = substr(str, 1, index(str, sep) - length(sep))
headtail[2] = substr(str, index(str, sep) + length(sep))
}
function call(key, args, bindings) {
if (!BINDING[key]) {
print "unregistered function call"
return
}
buildParameter(key, args, params)
switch (length(params)) {
case 1:
executeFunc1(fnname, params)
break
case 2:
executeFunc2(fnname, params)
break
case 3:
executeFunc3(fnname, params)
break
case 4:
executeFunc4(fnname, params)
break
default:
print "#(function params) must one of 1, 2, 3, or 4"
return
}
}
function buildParameter(key, args, params) {
partition(BINDING[key], SSEP, fnBinding)
fnname = fnBinding[1]
inspectParams(fnname, paramDict)
bindingRepr = fnBinding[2]
bindingRepr2Dict(bindingRepr, bindingDict)
for (idx in args) {
params[idx] = args[idx]
}
for (idx in paramDict) {
if (!params[paramDict[idx]]) {
params[paramDict[idx]] = bindingDict[idx]
}
}
if (length(paramDict) != length(params)) {
print "invalid execution, mismatch between original function and binded function"
delete params
}
}
function bindingRepr2Dict(repr, bindingDict, tmp) {
split(repr, tmp, SSEP)
for (idx in tmp) {
split(tmp[idx], keyVal, SUBSEP)
bindingDict[keyVal[1]] = keyVal[2]
}
}
function inspectParams(fnname, paramDict) {
posRepr = FUNCSIG[fnname]
posRepr2Dict(posRepr, paramDict)
}
function posRepr2Dict(posRepr, paramDict, tmp, posNameTuple) {
split(posRepr, tmp, SSEP)
for (idx in tmp) {
split(tmp[idx], posName, SUBSEP)
paramDict[posName[2]] = posName[1]
}
}
function executeFunc1(fnname, params) {
@fnname(params[1])
}
function executeFunc2(fnname, params) {
@fnname(params[1], params[2])
}
function executeFunc3(fnname, params) {
@fnname(params[1], params[2], params[3])
}
function executeFunc4(fnname, params) {
@fnname(params[1], params[2], params[3], params[4])
}
# save function signature to global variable FUNCSIG
# argument information is of form list of tuples (position, parameter name)
# list element delemter: SSEP, key-value delemeter: SUBSEP
function saveSignature(fnname, argInfo) {
posRepr = bindPosition(argInfo)
FUNCSIG[fnname] = posRepr
}
function zip(arr1, arr2, dict) {
minlen = (length(arr1) < length(arr2) ? length(arr1) : length(arr2))
for (i = 1; i <= minlen; i++) {
dict[arr1[i]] = arr2[i]
}
}
BEGIN {
SSEP = "\035"
split("a b c", arginfo)
saveSignature("sample", arginfo)
split("b c", keys)
split("5678 asdf", vals)
zip(keys, vals, bindings)
bind("partial", "sample", bindings)
split("1", args)
call("partial", args)
}
적절한 라이브러리에 분리하고 import를 사용하면 다음과 같다.
@include "common"
@include "functool"
function sample(a, b, c) {
printf "a: %s, b: %s, c: %s\n", a, b, c
}
BEGIN {
SSEP = "\035"
split("a b c", arginfo)
saveSignature("sample", arginfo)
split("b c", keys)
split("5678 asdf", vals)
zip(keys, vals, bindings)
bind("partial", "sample", bindings)
split("1", args)
call("partial", args)
}
출력 결과는 아래와 같다.
a: 1, b: 5678, c: asdf
@hugovk@mastodon.social · Reply to Hugo van Kemenade's post
Just released! 🚀
em-keyboard 5.3.0
🎲 Pick a random emoji from a search. For example:
❯ em --search music --random
Copied! 👩🎤 woman_singer
🧛♂️ Drop support for Python 3.9
@toxi@mastodon.thi.ng
#ReleaseFriday — New version 3.1.0 of the recently talked about https://thi.ng/args package, a declarative & functional CLI argument parser & app framework. I updated the arg specifications to be fully self-describing & serializable (with minor exceptions), and streamlined the API for factory functions to define the specs.
Why is this useful? For example, now I can (already have!) implemented a CLI as separate short-lived client/process which only acts as RPC frontend/proxy for the actual CLI commands defined & executed in a long running app server, which is heavily based on a plugin architecture. Each plugin can contribute any number of CLI commands, each with its own set of args/options... When the CLI client app is launched, it first retrieves a list of these registered commands and all their options from the server, then uses the https://thi.ng/args CLI framework to select the right command, validate its options or display formatted usage info. If all is ok, the command is then triggered via an HTTP request to the app server, executes there and the command's log messages are send back as response...
#ThingUmbrella #CLI #RPC #TypeScript #JavaScript #OpenSource #SoftwareArchitecture
@toxi@mastodon.thi.ng
Finally got around documenting a little more the small CLI app "framework" I've been using for almost a dozen projects now (incl. several work projects). The package in question is now already 3 years old (https://thi.ng/args), but I've only just managed now to add a basic, commented usage example for this `cliApp()` feature to the readme:
Defining a multi-command CLI app (incl. two sub-commands):
https://github.com/thi-ng/umbrella/blob/develop/packages/args/README.md#declarative-multi-command-cli-application
Also part of this: I've refactored a few other projects to simplify their CLI handling using this `cliApp()` wrapper (project links are in the above readme, in case you'd like to see more advanced/realworld uses...) One of the (non-public) work projects ended up consisting of up to a dozen sub-commands and I found this declarative and modular setup to be very, very helpful (and elegant)...
@toxi@mastodon.thi.ng
Finally got around documenting a little more the small CLI app "framework" I've been using for almost a dozen projects now (incl. several work projects). The package in question is now already 3 years old (https://thi.ng/args), but I've only just managed now to add a basic, commented usage example for this `cliApp()` feature to the readme:
Defining a multi-command CLI app (incl. two sub-commands):
https://github.com/thi-ng/umbrella/blob/develop/packages/args/README.md#declarative-multi-command-cli-application
Also part of this: I've refactored a few other projects to simplify their CLI handling using this `cliApp()` wrapper (project links are in the above readme, in case you'd like to see more advanced/realworld uses...) One of the (non-public) work projects ended up consisting of up to a dozen sub-commands and I found this declarative and modular setup to be very, very helpful (and elegant)...
@fp@social.lol
If you're working in the command line daily, here are some tools that made my life better:
- https://github.com/ajeetdsouza/zoxide for switching directories with more comfort
- https://github.com/eza-community/eza for more pleasant directory listings
- https://atuin.sh for helpful history
- https://github.com/BurntSushi/ripgrep for faster search in files
- https://github.com/junegunn/fzf for finding files faster
- https://starship.rs for fast helpful shell prompts
And give https://fishshell.com a try while you're at it, it's great.
@fp@social.lol
If you're working in the command line daily, here are some tools that made my life better:
- https://github.com/ajeetdsouza/zoxide for switching directories with more comfort
- https://github.com/eza-community/eza for more pleasant directory listings
- https://atuin.sh for helpful history
- https://github.com/BurntSushi/ripgrep for faster search in files
- https://github.com/junegunn/fzf for finding files faster
- https://starship.rs for fast helpful shell prompts
And give https://fishshell.com a try while you're at it, it's great.
@nev@status.nevillepark.ca
I only just learned you can use the mouse in the TTY! (The Linux text-only console you get to by pressing Ctrl+Alt+F1, F2, etc.)
Some applications that enable this are gpm and consolation.
consolation worked better for me, especially when in tmux; however, I still can't get scrolling with middle button and trackpoint to work, which is what would be the most useful for me. I don't know if it has to do with consolation, tmux mouse bindings, my particular ThinkPad model, etc. I can't find anything online about this, so if you've also dabbled in this, please share your experience!
@toxi@mastodon.thi.ng
Speaking of new tools: Here's some other open-ended and work-in-progress tooling I published recently:
Assorted CLI utilities for data wrangling & media conversion
https://codeberg.org/thi.ng/thing-tools
This is (will be) a Swiss-army knife type multi-tool for frequent little tasks I've been encountering and not found satisfactory equivalent other solutions for. So far, there're only two commands published, but a dozen or so more are to come (for which I still have more cleaning up to do, also in upstream projects):
- CSV-to-JSON parsing/conversion, with configurable filtering, renaming and column value coercions
- De-dupe lines with support for regexp-based inclusions, exclusions and pattern-based uniqueness. Patterns can be read from files.
The readme contains installation instructions and documentation for all commands, their options and some example use cases. E.g. I regularly use the `dedupe-lines` command to cleanup my `.bash_history` file.
Using https://bun.sh, the tool can be compiled into a standalone executable.
All commands share common infrastructure of the main CLI tooling (based on https://thi.ng/args and many other https://thi.ng/umbrella packages). This reduces the code size of each command and makes it trivial to add additional commands (or share functionality, invoke some of those other commands for sub-tasks). There're also re-usable CLI arg specs to provide a uniform "API" for certain types of parameters.
Some of the still unreleased commands are for `ffmpeg` workflows/tasks, will update when ready...
#OpenSource #ThingUmbrella #CLI #TypeScript #JavaScript #Utilities
@hongminhee@hollo.social
Big update for our type-safe combinatorial #CLI parser for #TypeScript:
showDefault: automatic default value displayThe help text has never looked this good!
@hongminhee@hackers.pub
We're excited to announce Optique 0.4.0, which brings significant improvements to help text organization, enhanced documentation capabilities, and introduces comprehensive Temporal API support.
Optique is a type-safe combinatorial CLI parser for TypeScript that makes building command-line interfaces intuitive and maintainable. This release focuses on making your CLI applications more user-friendly and maintainable.
One of the most visible improvements in Optique 0.4.0 is the enhanced help text organization. You can now label and group your options more effectively, making complex CLIs much more approachable for users.
The merge() combinator now accepts an optional label parameter, solving
a common pain point where developers had to choose between clean code structure
and organized help output:
// Before: unlabeled merged options appeared scattered
const config = merge(connectionOptions, performanceOptions);
// Now: group related options under a clear section
const config = merge(
"Server Configuration", // New label parameter
connectionOptions,
performanceOptions
);
This simple addition makes a huge difference in help text readability, especially for CLIs with many options spread across multiple reusable modules.
The resulting help output clearly organizes options under
the Server Configuration section:
Demo app showcasing labeled merge groups
Usage: demo-merge.ts --host STRING --port INTEGER --timeout INTEGER --retries
INTEGER
Server Configuration:
--host STRING Server hostname or IP address
--port INTEGER Port number for the connection
--timeout INTEGER Connection timeout in seconds
--retries INTEGER Number of retry attempts
group() combinator For cases where merge() doesn't apply, the new group()
combinator lets you wrap any parser with a documentation label:
// Group mutually exclusive options under a clear section
const outputFormat = group(
"Output Format",
or(
map(flag("--json"), () => "json"),
map(flag("--yaml"), () => "yaml"),
map(flag("--xml"), () => "xml"),
)
);
This is particularly useful for organizing mutually exclusive flags, multiple inputs, or any parser that doesn't natively support labeling. The resulting help text becomes much more scannable and user-friendly.
Here's how the grouped output format options appear in the help text:
Demo app showcasing group combinator
Usage: demo-group.ts --json
demo-group.ts --yaml
demo-group.ts --xml
Output Format:
--json Output in JSON format
--yaml Output in YAML format
--xml Output in XML format
Optique 0.4.0 introduces comprehensive documentation fields that can be added
directly through the run() function, eliminating the need to modify parser
definitions for documentation purposes.
Both @optique/core/facade and @optique/run now support brief,
description, and footer options through the run() function:
import { run } from "@optique/run";
import { message } from "@optique/core/message";
const result = run(parser, {
brief: message`A powerful data processing tool`,
description: message`This tool provides comprehensive data processing capabilities with support for multiple formats and transformations. It can handle JSON, YAML, and CSV files with automatic format detection.`,
footer: message`Examples:
myapp process data.json --format yaml
myapp validate config.toml --strict
For more information, visit https://example.com/docs`,
help: "option"
});
These documentation fields appear in both help output and error messages (when configured), providing consistent context throughout your CLI's user experience.
The complete help output demonstrates the rich documentation features with brief description, detailed explanation, option descriptions, default values, and footer information:
A powerful data processing tool
Usage: demo-rich-docs.ts [--port INTEGER] [--format STRING] --verbose STRING
This tool provides comprehensive data processing capabilities with support for
multiple formats and transformations. It can handle JSON, YAML, and CSV files
with automatic format detection.
--port INTEGER Server port number [3000]
--format STRING Output format [json]
--verbose STRING Verbosity level
Examples:
myapp process data.json --format yaml
myapp validate config.toml --strict
For more information, visit https://example.com/docs
These documentation fields appear in both help output and error messages (when configured), providing consistent context throughout your CLI's user experience.
A frequently requested feature is now available: showing default values
directly in help text. Enable this with the new showDefault option when
using withDefault():
const parser = object({
port: withDefault(
option("--port", integer(), { description: message`Server port number` }),
3000,
),
format: withDefault(
option("--format", string(), { description: message`Output format` }),
"json",
),
});
run(parser, { showDefault: true });
// Or with custom formatting:
run(parser, {
showDefault: {
prefix: " (default: ",
suffix: ")"
} // Shows: --port (default: 3000)
});
Default values are automatically dimmed when colors are enabled, making them visually distinct while remaining readable.
The help output shows default values clearly marked next to each option:
Usage: demo-defaults.ts [--port INTEGER] [--format STRING]
--port INTEGER Server port number [3000]
--format STRING Output format [json]
Optique 0.4.0 introduces a new package, @optique/temporal, providing comprehensive support for the modern Temporal API. This brings type-safe parsing for dates, times, durations, and time zones:
import { instant, duration, zonedDateTime } from "@optique/temporal";
import { option } from "@optique/core/parser";
const parser = object({
// Parse ISO 8601 timestamps
timestamp: option("--at", instant()),
// Parse durations like "PT30M" or "P1DT2H"
timeout: option("--timeout", duration()),
// Parse zoned datetime with timezone info
meeting: option("--meeting", zonedDateTime()),
});
The temporal parsers return native Temporal objects with full functionality:
const result = parse(timestampArg, ["2023-12-25T10:30:00Z"]);
if (result.success) {
const instant = result.value;
console.log(`UTC: ${instant.toString()}`);
console.log(`Seoul: ${instant.toZonedDateTimeISO("Asia/Seoul")}`);
}
Install the new package with:
npm add @optique/temporal
The merge() combinator now supports up to 10 parsers (previously 5), and
the tuple() parser has improved type inference using TypeScript's const
type parameter. These enhancements enable more complex CLI structures while
maintaining perfect type safety.
While we've maintained backward compatibility for most APIs, there are a few changes to be aware of:
Parser.getDocFragments() method now uses DocState<TState> instead
of direct state values (only affects custom parser implementations)merge() combinator now enforces stricter type
constraints at compile time, rejecting non-object-producing parsersFor a complete list of changes, bug fixes, and improvements, see the full changelog.
Check out the updated documentation:
merge() and group() usageUpgrade to Optique 0.4.0:
npm update @optique/core @optique/run
# or
deno add jsr:@optique/core@^0.4.0 jsr:@optique/run@^0.4.0
Add temporal support (optional):
npm add @optique/temporal
# or
deno add jsr:@optique/temporal
We hope these improvements make building CLI applications with Optique even more enjoyable. As always, we welcome your feedback and contributions on GitHub.
@hongminhee@hollo.social
Big update for our type-safe combinatorial #CLI parser for #TypeScript:
showDefault: automatic default value displayThe help text has never looked this good!
@hongminhee@hackers.pub
We're excited to announce Optique 0.4.0, which brings significant improvements to help text organization, enhanced documentation capabilities, and introduces comprehensive Temporal API support.
Optique is a type-safe combinatorial CLI parser for TypeScript that makes building command-line interfaces intuitive and maintainable. This release focuses on making your CLI applications more user-friendly and maintainable.
One of the most visible improvements in Optique 0.4.0 is the enhanced help text organization. You can now label and group your options more effectively, making complex CLIs much more approachable for users.
The merge() combinator now accepts an optional label parameter, solving
a common pain point where developers had to choose between clean code structure
and organized help output:
// Before: unlabeled merged options appeared scattered
const config = merge(connectionOptions, performanceOptions);
// Now: group related options under a clear section
const config = merge(
"Server Configuration", // New label parameter
connectionOptions,
performanceOptions
);
This simple addition makes a huge difference in help text readability, especially for CLIs with many options spread across multiple reusable modules.
The resulting help output clearly organizes options under
the Server Configuration section:
Demo app showcasing labeled merge groups
Usage: demo-merge.ts --host STRING --port INTEGER --timeout INTEGER --retries
INTEGER
Server Configuration:
--host STRING Server hostname or IP address
--port INTEGER Port number for the connection
--timeout INTEGER Connection timeout in seconds
--retries INTEGER Number of retry attempts
group() combinator For cases where merge() doesn't apply, the new group()
combinator lets you wrap any parser with a documentation label:
// Group mutually exclusive options under a clear section
const outputFormat = group(
"Output Format",
or(
map(flag("--json"), () => "json"),
map(flag("--yaml"), () => "yaml"),
map(flag("--xml"), () => "xml"),
)
);
This is particularly useful for organizing mutually exclusive flags, multiple inputs, or any parser that doesn't natively support labeling. The resulting help text becomes much more scannable and user-friendly.
Here's how the grouped output format options appear in the help text:
Demo app showcasing group combinator
Usage: demo-group.ts --json
demo-group.ts --yaml
demo-group.ts --xml
Output Format:
--json Output in JSON format
--yaml Output in YAML format
--xml Output in XML format
Optique 0.4.0 introduces comprehensive documentation fields that can be added
directly through the run() function, eliminating the need to modify parser
definitions for documentation purposes.
Both @optique/core/facade and @optique/run now support brief,
description, and footer options through the run() function:
import { run } from "@optique/run";
import { message } from "@optique/core/message";
const result = run(parser, {
brief: message`A powerful data processing tool`,
description: message`This tool provides comprehensive data processing capabilities with support for multiple formats and transformations. It can handle JSON, YAML, and CSV files with automatic format detection.`,
footer: message`Examples:
myapp process data.json --format yaml
myapp validate config.toml --strict
For more information, visit https://example.com/docs`,
help: "option"
});
These documentation fields appear in both help output and error messages (when configured), providing consistent context throughout your CLI's user experience.
The complete help output demonstrates the rich documentation features with brief description, detailed explanation, option descriptions, default values, and footer information:
A powerful data processing tool
Usage: demo-rich-docs.ts [--port INTEGER] [--format STRING] --verbose STRING
This tool provides comprehensive data processing capabilities with support for
multiple formats and transformations. It can handle JSON, YAML, and CSV files
with automatic format detection.
--port INTEGER Server port number [3000]
--format STRING Output format [json]
--verbose STRING Verbosity level
Examples:
myapp process data.json --format yaml
myapp validate config.toml --strict
For more information, visit https://example.com/docs
These documentation fields appear in both help output and error messages (when configured), providing consistent context throughout your CLI's user experience.
A frequently requested feature is now available: showing default values
directly in help text. Enable this with the new showDefault option when
using withDefault():
const parser = object({
port: withDefault(
option("--port", integer(), { description: message`Server port number` }),
3000,
),
format: withDefault(
option("--format", string(), { description: message`Output format` }),
"json",
),
});
run(parser, { showDefault: true });
// Or with custom formatting:
run(parser, {
showDefault: {
prefix: " (default: ",
suffix: ")"
} // Shows: --port (default: 3000)
});
Default values are automatically dimmed when colors are enabled, making them visually distinct while remaining readable.
The help output shows default values clearly marked next to each option:
Usage: demo-defaults.ts [--port INTEGER] [--format STRING]
--port INTEGER Server port number [3000]
--format STRING Output format [json]
Optique 0.4.0 introduces a new package, @optique/temporal, providing comprehensive support for the modern Temporal API. This brings type-safe parsing for dates, times, durations, and time zones:
import { instant, duration, zonedDateTime } from "@optique/temporal";
import { option } from "@optique/core/parser";
const parser = object({
// Parse ISO 8601 timestamps
timestamp: option("--at", instant()),
// Parse durations like "PT30M" or "P1DT2H"
timeout: option("--timeout", duration()),
// Parse zoned datetime with timezone info
meeting: option("--meeting", zonedDateTime()),
});
The temporal parsers return native Temporal objects with full functionality:
const result = parse(timestampArg, ["2023-12-25T10:30:00Z"]);
if (result.success) {
const instant = result.value;
console.log(`UTC: ${instant.toString()}`);
console.log(`Seoul: ${instant.toZonedDateTimeISO("Asia/Seoul")}`);
}
Install the new package with:
npm add @optique/temporal
The merge() combinator now supports up to 10 parsers (previously 5), and
the tuple() parser has improved type inference using TypeScript's const
type parameter. These enhancements enable more complex CLI structures while
maintaining perfect type safety.
While we've maintained backward compatibility for most APIs, there are a few changes to be aware of:
Parser.getDocFragments() method now uses DocState<TState> instead
of direct state values (only affects custom parser implementations)merge() combinator now enforces stricter type
constraints at compile time, rejecting non-object-producing parsersFor a complete list of changes, bug fixes, and improvements, see the full changelog.
Check out the updated documentation:
merge() and group() usageUpgrade to Optique 0.4.0:
npm update @optique/core @optique/run
# or
deno add jsr:@optique/core@^0.4.0 jsr:@optique/run@^0.4.0
Add temporal support (optional):
npm add @optique/temporal
# or
deno add jsr:@optique/temporal
We hope these improvements make building CLI applications with Optique even more enjoyable. As always, we welcome your feedback and contributions on GitHub.
@hongminhee@hollo.social
Big update for our type-safe combinatorial #CLI parser for #TypeScript:
showDefault: automatic default value displayThe help text has never looked this good!
@hongminhee@hackers.pub
We're excited to announce Optique 0.4.0, which brings significant improvements to help text organization, enhanced documentation capabilities, and introduces comprehensive Temporal API support.
Optique is a type-safe combinatorial CLI parser for TypeScript that makes building command-line interfaces intuitive and maintainable. This release focuses on making your CLI applications more user-friendly and maintainable.
One of the most visible improvements in Optique 0.4.0 is the enhanced help text organization. You can now label and group your options more effectively, making complex CLIs much more approachable for users.
The merge() combinator now accepts an optional label parameter, solving
a common pain point where developers had to choose between clean code structure
and organized help output:
// Before: unlabeled merged options appeared scattered
const config = merge(connectionOptions, performanceOptions);
// Now: group related options under a clear section
const config = merge(
"Server Configuration", // New label parameter
connectionOptions,
performanceOptions
);
This simple addition makes a huge difference in help text readability, especially for CLIs with many options spread across multiple reusable modules.
The resulting help output clearly organizes options under
the Server Configuration section:
Demo app showcasing labeled merge groups
Usage: demo-merge.ts --host STRING --port INTEGER --timeout INTEGER --retries
INTEGER
Server Configuration:
--host STRING Server hostname or IP address
--port INTEGER Port number for the connection
--timeout INTEGER Connection timeout in seconds
--retries INTEGER Number of retry attempts
group() combinator For cases where merge() doesn't apply, the new group()
combinator lets you wrap any parser with a documentation label:
// Group mutually exclusive options under a clear section
const outputFormat = group(
"Output Format",
or(
map(flag("--json"), () => "json"),
map(flag("--yaml"), () => "yaml"),
map(flag("--xml"), () => "xml"),
)
);
This is particularly useful for organizing mutually exclusive flags, multiple inputs, or any parser that doesn't natively support labeling. The resulting help text becomes much more scannable and user-friendly.
Here's how the grouped output format options appear in the help text:
Demo app showcasing group combinator
Usage: demo-group.ts --json
demo-group.ts --yaml
demo-group.ts --xml
Output Format:
--json Output in JSON format
--yaml Output in YAML format
--xml Output in XML format
Optique 0.4.0 introduces comprehensive documentation fields that can be added
directly through the run() function, eliminating the need to modify parser
definitions for documentation purposes.
Both @optique/core/facade and @optique/run now support brief,
description, and footer options through the run() function:
import { run } from "@optique/run";
import { message } from "@optique/core/message";
const result = run(parser, {
brief: message`A powerful data processing tool`,
description: message`This tool provides comprehensive data processing capabilities with support for multiple formats and transformations. It can handle JSON, YAML, and CSV files with automatic format detection.`,
footer: message`Examples:
myapp process data.json --format yaml
myapp validate config.toml --strict
For more information, visit https://example.com/docs`,
help: "option"
});
These documentation fields appear in both help output and error messages (when configured), providing consistent context throughout your CLI's user experience.
The complete help output demonstrates the rich documentation features with brief description, detailed explanation, option descriptions, default values, and footer information:
A powerful data processing tool
Usage: demo-rich-docs.ts [--port INTEGER] [--format STRING] --verbose STRING
This tool provides comprehensive data processing capabilities with support for
multiple formats and transformations. It can handle JSON, YAML, and CSV files
with automatic format detection.
--port INTEGER Server port number [3000]
--format STRING Output format [json]
--verbose STRING Verbosity level
Examples:
myapp process data.json --format yaml
myapp validate config.toml --strict
For more information, visit https://example.com/docs
These documentation fields appear in both help output and error messages (when configured), providing consistent context throughout your CLI's user experience.
A frequently requested feature is now available: showing default values
directly in help text. Enable this with the new showDefault option when
using withDefault():
const parser = object({
port: withDefault(
option("--port", integer(), { description: message`Server port number` }),
3000,
),
format: withDefault(
option("--format", string(), { description: message`Output format` }),
"json",
),
});
run(parser, { showDefault: true });
// Or with custom formatting:
run(parser, {
showDefault: {
prefix: " (default: ",
suffix: ")"
} // Shows: --port (default: 3000)
});
Default values are automatically dimmed when colors are enabled, making them visually distinct while remaining readable.
The help output shows default values clearly marked next to each option:
Usage: demo-defaults.ts [--port INTEGER] [--format STRING]
--port INTEGER Server port number [3000]
--format STRING Output format [json]
Optique 0.4.0 introduces a new package, @optique/temporal, providing comprehensive support for the modern Temporal API. This brings type-safe parsing for dates, times, durations, and time zones:
import { instant, duration, zonedDateTime } from "@optique/temporal";
import { option } from "@optique/core/parser";
const parser = object({
// Parse ISO 8601 timestamps
timestamp: option("--at", instant()),
// Parse durations like "PT30M" or "P1DT2H"
timeout: option("--timeout", duration()),
// Parse zoned datetime with timezone info
meeting: option("--meeting", zonedDateTime()),
});
The temporal parsers return native Temporal objects with full functionality:
const result = parse(timestampArg, ["2023-12-25T10:30:00Z"]);
if (result.success) {
const instant = result.value;
console.log(`UTC: ${instant.toString()}`);
console.log(`Seoul: ${instant.toZonedDateTimeISO("Asia/Seoul")}`);
}
Install the new package with:
npm add @optique/temporal
The merge() combinator now supports up to 10 parsers (previously 5), and
the tuple() parser has improved type inference using TypeScript's const
type parameter. These enhancements enable more complex CLI structures while
maintaining perfect type safety.
While we've maintained backward compatibility for most APIs, there are a few changes to be aware of:
Parser.getDocFragments() method now uses DocState<TState> instead
of direct state values (only affects custom parser implementations)merge() combinator now enforces stricter type
constraints at compile time, rejecting non-object-producing parsersFor a complete list of changes, bug fixes, and improvements, see the full changelog.
Check out the updated documentation:
merge() and group() usageUpgrade to Optique 0.4.0:
npm update @optique/core @optique/run
# or
deno add jsr:@optique/core@^0.4.0 jsr:@optique/run@^0.4.0
Add temporal support (optional):
npm add @optique/temporal
# or
deno add jsr:@optique/temporal
We hope these improvements make building CLI applications with Optique even more enjoyable. As always, we welcome your feedback and contributions on GitHub.
@elena@aseachange.com
🏕️ my adventures in #selfhosting: day 259 (slow down edition) 🐌
a blog post that discusses the sense of urgency I felt to learn #Docker (because it will become mandatory for #Ghost)... and how a recent discovery has pushed back my deadline. I can learn slowly, yay!
🔗: https://news.elenarossini.com/my-so-called-sudo-life/my-adventures-in-self-hosting-day-259-slow-down-edition/
#MySoCalledSudoLife #CLI
@quincy@chaos.social
#cli: extract structure from a blob of #json data
cat very-large-file.jsonl | jq -r 'paths(scalars) | map(tostring) | join(".")' | perl -ne 's/[.][0-9]+(?=[.]|$)/.[]/g; print' | python -c $'import sys\na=set()\nfor l in iter(sys.stdin.readline, ""):\n if l in a: continue\n sys.stdout.write(l)\n a.add(l)' > schema-like.txt
@quincy@chaos.social
@ann3nova@corteximplant.com
@orhun@fosstodon.org
Terminal power users will like this 🔥
🌀 **tiny-dc** — A tiny but mighty TUI directory changer.
🚀 Faster than doing cd + ls
💯 Supports jumping to previously visited directories
🍬 Has Vim-like key bindings
🦀 Written in Rust & built with @ratatui_rs
⭐ GitHub: https://github.com/n1ghtmare/tiny-dc
#rustlang #ratatui #tui #tool #commandline #directory #terminal #cli
radare 
@radareorg@infosec.exchange
radare2 6.0 is out! (codename "brainbow" 🧠🌈)
A major release focused on stability and maintainability while bringing many new features under the hood. Breaking the ABI compatibility from the 5.9.x saga for to settle a new base for the upcoming versions. #reverseengineering #radare2 #unix #cli
@ann3nova@corteximplant.com
@smallcircles@social.coop
@pvergain@kolektiva.social
- https://willmcgugan.github.io/announcing-toad/ (2025-07-23, Announcing Toad - a universal UI for agentic coding in the terminal, by https://willmcgugan.github.io/, @willmcgugan)
--<--
I’m a little salty that neither Anthropic nor Google reached out to me before they released their terminal-based AI coding agents.
You see until recently I was the CEO of Textualize, a startup promoting rich applications for the terminal. Textualize didn’t make it as a company, but I take heart that we built something amazing. There is now a thriving community of folk building TUIs that I am still a part of.
So you will understand why when I finally got round to checking out Claude code and Gemini CLI, I was more interested in the terminal interface than the AI magic it was performing. And I was not impressed. Both projects suffer from jank and other glitches inherent to terminals that Textualize solved years ago.
....
I’m currently taking a year’s sabbatical. When Textualize wrapped up I genuinely thought I was sick of coding, and I would never gain be able to find joy in building things. I’m happy to be wrong about that. I still enjoy coding, and Toad feels like the perfect hobby project for my very particular set of skills. Something I can build while continuing to focus on my physical and mental health (running a startup is taxing).
So I am going to build it.
I am building it.
Here’s a quick video of Toad in its current state: https://www.youtube.com/watch?v=EKsCS54xduo
What I have in mind is a universal front-end for AI in the terminal. This includes both AI chat-bots and agentic coding. The architecture I alluded to earlier is that the front-end built with Python and Textual connects to a back-end subprocess. The back-end handles the interactions with the LLM and performs any agentic coding, while the front-end provides the user interface. The two sides communicate with each other by sending and receiving JSON over stdout and stdin.
...
Toad isn’t quite ready for a public release. It remains a tadpole for now, incubating in a private repository. But you know I’m all about FOSS, and when its ready for a public beta I will release Toad under an Open Source license.
With a bit of luck, this sabbatical needn’t eat in to my retirement fund too much. If it goes well, it may even become my full-time gig.
I will shortly invite a few tech friends and collaborators to the project. These things can’t be the work of a single individual and I am going to need feedback as I work. If you would like to be a part of that, then feel free to reach out. But please note, I would like to prioritize folk in the Open Source community who have potentially related projects.
For everyone else, I will be posting updates regularly here and on my socials (link at the bottom of the page). Expect screenshots, videos, and long form articles. Please be patient—you will be agentic toading before too long.
Looking for markdown streaming? : https://willmcgugan.github.io/streaming-markdown/ (Efficient streaming of Markdown in the terminal)
-->--
#CLI #Terminal #python #textual #WillMcGugan #Toad #markdown
@pvergain@kolektiva.social
- https://willmcgugan.github.io/announcing-toad/ (2025-07-23, Announcing Toad - a universal UI for agentic coding in the terminal, by https://willmcgugan.github.io/, @willmcgugan)
--<--
I’m a little salty that neither Anthropic nor Google reached out to me before they released their terminal-based AI coding agents.
You see until recently I was the CEO of Textualize, a startup promoting rich applications for the terminal. Textualize didn’t make it as a company, but I take heart that we built something amazing. There is now a thriving community of folk building TUIs that I am still a part of.
So you will understand why when I finally got round to checking out Claude code and Gemini CLI, I was more interested in the terminal interface than the AI magic it was performing. And I was not impressed. Both projects suffer from jank and other glitches inherent to terminals that Textualize solved years ago.
....
I’m currently taking a year’s sabbatical. When Textualize wrapped up I genuinely thought I was sick of coding, and I would never gain be able to find joy in building things. I’m happy to be wrong about that. I still enjoy coding, and Toad feels like the perfect hobby project for my very particular set of skills. Something I can build while continuing to focus on my physical and mental health (running a startup is taxing).
So I am going to build it.
I am building it.
Here’s a quick video of Toad in its current state: https://www.youtube.com/watch?v=EKsCS54xduo
What I have in mind is a universal front-end for AI in the terminal. This includes both AI chat-bots and agentic coding. The architecture I alluded to earlier is that the front-end built with Python and Textual connects to a back-end subprocess. The back-end handles the interactions with the LLM and performs any agentic coding, while the front-end provides the user interface. The two sides communicate with each other by sending and receiving JSON over stdout and stdin.
...
Toad isn’t quite ready for a public release. It remains a tadpole for now, incubating in a private repository. But you know I’m all about FOSS, and when its ready for a public beta I will release Toad under an Open Source license.
With a bit of luck, this sabbatical needn’t eat in to my retirement fund too much. If it goes well, it may even become my full-time gig.
I will shortly invite a few tech friends and collaborators to the project. These things can’t be the work of a single individual and I am going to need feedback as I work. If you would like to be a part of that, then feel free to reach out. But please note, I would like to prioritize folk in the Open Source community who have potentially related projects.
For everyone else, I will be posting updates regularly here and on my socials (link at the bottom of the page). Expect screenshots, videos, and long form articles. Please be patient—you will be agentic toading before too long.
Looking for markdown streaming? : https://willmcgugan.github.io/streaming-markdown/ (Efficient streaming of Markdown in the terminal)
-->--
#CLI #Terminal #python #textual #WillMcGugan #Toad #markdown
@unixroot@indieweb.social
@unixroot@indieweb.social
@kodingwarrior@hackers.pub
이 글(그리고 후속작이 될 글들)은, 내 개발환경에서 자주 사용하고 있고 실제로도 애정하고 있는 도구에 대해서 소개하게 될 것 같다. 내가 어떤 환경에서 개발하고 있는지 궁금한 분들은 내 dotfiles 리포지토리를 참고해도 좋을 것 같다.
dotfiles라는 이름 자체만 보면 뭔가 대단해보일 것 같지만, dotfiles라는 이름 자체는 그냥 단순하다.
.zshrc/.bashrc 같은 것들을 마주하게 될 것이다..gitconfig 같은 파일을 수정하게 될 때가 있다.
git config pull.rebase true 같은 명령어를 실행하는 경우가 더 많을 수 있다. 하지만, 이런 명령어를 실행하면 .gitconfig에도 그대로 기록이 된다.위에서 언급한 예시를 보면 알 수 있겠듯이, 앞에 dot(.)이 붙어있는 설정파일이라면 dotfiles라고 할 수 있겠다. dotfiles 리포지토리를 만들어서 관리를 하는 이유는 무엇인가? 그것은 바로 어떤 환경에서든 .zshrc/.gitignore 파일 같은 것들을 동일하게 사용하여 작업의 흐름을 온전히 유지할 수 있다는 장점이 있기 때문이다. dotfiles를 git과 같은 버전관리 도구로 관리할 수 있고, github 같은 저장소에 올려놓을 수 있다면.... 어떤 개발환경으로 갈아타더라도 github에서 바로 내려받고, 각 설정파일들을 옮기면 그만이기 때문에 개발환경 설정하는데 드는 시간적 비용을 굉장히 아낄 수 있다.
dotfiles를 관리하는 방법들은 여러가지 있겠지만(symbolic link를 이용한다던가 등등), 개인적으로는 chezmoi를 권장하는 바이다. chezmoi는 dotfiles들을 버전관리할 수 있게 편의성을 제공해주는 CLI 도구이다.
chezmoi init https://github.com/malkoG/dotfiles.git 명령을 실행해보면 된다.Wezterm은 Konsole/iTerm2/Gnome Terminal/Alacritty과 같은 터미널 에뮬레이터이며, Rust 기반으로 구축이 되어 있고, GPU 가속을 지원한다. 따라서, 렌더링 자체도 어느 정도는 빠른 편이다.
주변 사람들에게 한번 써보도록 권장하는 터미널 에뮬레이터가 세 가지 정도 있는데, Alacritty/Kitty 그리고 이 글에서 소개하는 Wezterm 정도 된다. 요즘은 Zig 기반으로 만들어진 Ghostty[1]도 추천할만 한 것 같다. 하지만, 이 글에서는 Wezterm을 소개하기로 했기 때문에, Wezterm 중심으로 소개하도록 하겠다.
Wezterm은 다음과 같은 특징을 가진다.
Wezterm을 설치한다면 설치 안내 페이지를 참고해서 설치하면 되는데, 여러분이 Wezterm을 설치했다면 당장은 검은 화면만 뜰지도 모른다.
Wezterm을 설치하고 나서, .config/wezterm/wezterm.lua 파일을 수정해야 하는데, 당장은 아래처럼 비어있을 것이다. 파일이 없다면 만들어두는 것이 좋다.
return {}
위의 코드에서 {}는 lua에서는 테이블(다른 언어로 치면, 딕셔너리/오브젝트 같은 것)이지만, wezterm 터미널의 configuration을 나타내는 테이블이다. 여기에 몇가지 추가사항을 넣어보겠다.
터미널 에뮬레이터를 설치했는데, 터미널 에뮬레이터를 설치했으면 가장 처음부터 하는게 무엇이겠는가? 바로, 폰트를 세팅하는 것이다. 터미널 환경에서 작업할때 폰트만큼 중요한게 또 없다.
local wezterm = require("wezterm")
return {
font = wezterm.font_with_fallback({'Cascadia Code NF', 'NanumBarunGothic'}),
font_size = 12.0,
line_height = 1.2,
}
폰트를 가져다 쓸때는 위의 예시와 같이 font_with_fallback 함수를 이용해서 가져다 쓸 수 있고, 그 외에도 폰트 크기를 지정하거나 행간을 지정할 수도 있다. 공식페이지에서 보았듯이, 여러분의 취향에 따라 배경색 혹은 배경이미지도 지정할 수 있는데 여러분 나름대로의 기준이 있고 욕심이 난다면 한번 도전해보는 것도 나쁘지 않을 것 같다.
위의 코드를 복사 붙여넣고 편집하다보면 느낄 수 있겠지만, wezterm은 설정파일을 편집할때 Hot Reloading을 지원한다. 이 또한, 내가 가장 애정하는 기능 중 하나이다. 혹여나 wezterm 설정 파일을 수정했을때, 문법에 오류가 있거나 설정값을 잘못 지정했을 때, 새 창으로 어떤 부분에 오류가 있는지 친절하게 Alert도 띄워준다.
API 레퍼런스를 보기만 해도 스크립팅으로 기능을 확장할 수 있는 가능성이야 당연히 많긴 하겠지만, 처음 접하는 입장에서는 어떻게 커스터마이징할 지 파악하기 난해할 수 있다.
아래에서는 내가 어떻게 Wezterm을 커스터마이징을 하고 있는지 예시를 나열하는 것으로 글을 끝내겠다. Wezterm, 믿고 써보시라.
Wezterm에서 터미널 색상을 설정할때, 배경색상의 반투명도를 지정할 수 있는 옵션이 있다. 나는 여기서 단축키를 입력했을때 반투명도를 동적으로 조절하고 싶었다.
반투명도를 상수로 둘 수는 있지만, 모니터 하나 짜리의 환경에서 작업한다면 브라우저를 뒤쪽에 두고 터미널 앱을 앞에 두는 식으로 작업을 많이 하게 된다. HMR(Hot Module Reloading)이 되는 개발환경이라면, 소스코드를 편집하고 화면에 즉각적으로 반영이 되는걸 기대할텐데 이걸 탭 스위칭하면서 확인하기는 굉장히 번거롭다. 온전히 작업을 유지하다가 잠깐 확인하고 싶을때 반투명도를 변경하면 되는데도 말이다.
Wezterm에서는 이벤트를 발신할 수 있고, 다른 프로세스에서 특정 이벤트를 수신했을때 어떤 동작을 할 것인지를 정의할 수 있다. Wezterm 터미널 옵션을 수정하는것도 여기에 포함될 수 있다. 특정 단축키를 입력하면, 어떤 이벤트를 발생시킬 수 있고, 그 이벤트로 인해서 화면의 반투명도를 조정할 수 있게 했다.
local default_opacity = 0.9
local keymaps = {}
-- SHIFT + CTRL + Z 키를 누르면 반투명도를 감소시키는 이벤트가 발생한다.
table.insert(
keymaps,
{
key = "Z",
mods = 'SHIFT|CTRL',
action = wezterm.action.EmitEvent 'decrease-opacity',
}
)
-- SHIFT + CTRL + X 키를 누르면 반투명도를 증가시키는 이벤트가 발생한다.
table.insert(
keymaps,
{
key = 'X',
mods = 'SHIFT|CTRL',
action = wezterm.action.EmitEvent 'increase-opacity',
}
)
-- "increase-opacity" 이벤트를 수신했을때, 반투명도를 증가시키는 동작을 하도록 정의한다.
wezterm.on('increase-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
local opacity = overrides.window_background_opacity
if opacity == nil then
opacity = default_opacity
end
opacity = opacity + 0.1
if opacity > 1.0 then
opacity = 1.0
end
overrides.window_background_opacity = opacity
window:set_config_overrides(overrides)
end)
-- "increase-opacity" 이벤트를 수신했을때, 반투명도를 증가시키는 동작을 하도록 정의한다.
wezterm.on('decrease-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
local opacity = overrides.window_background_opacity
if opacity == nil then
opacity = default_opacity
end
opacity = opacity - 0.1
if opacity < 0.3 then
opacity = 0.3
end
overrides.window_background_opacity = opacity
window:set_config_overrides(overrides)
end)
return {
keys = keymaps
}
대부분 터미널 에뮬레이터에서 탭 이름을 표시할때, 현재 탭에서 돌고 있는 프로세스의 이름을 명시할때가 많다. 그런데, 탭에 명시되어 있는 타이틀만 가지고는 각각의 탭이 어떤 역할을 하는 것인지 파악하기 어렵다. 어느 쪽이 서버를 띄우고 있는건지, 어느 쪽이 에디터 편집 화면인지, 어느 쪽이 LLM Agent를 돌리고 있는지 난해하다.
하지만, 아래처럼 wezterm.action.PromptInputLine API를 사용해서 프롬프트 입력을 받은 내용을 기반으로, 현재 활성화된 탭의 이름을 변경하는 식으로 인지부하를 줄일 수 있다.
local wezterm = require('wezterm')
local keymaps = {}
table.insert(
keymaps,
{
key = '`',
mods = 'CTRL',
action = wezterm.action.PromptInputLine {
description = "Enter new name for tab",
action = wezterm.action_callback(function(window, _, line)
if line then
window:active_tab():set_title(line)
end
end)
}
}
)
return {
keys = keymaps
}
Aider나 Claude Code 같은 LLM 에이전트가 작업을 수행 후 아예 작업이 끝났거나, 혹은 작업에 대한 승인을 요구할 때가 간혹 있다. LLM 에이전트가 작업을 수행하는걸 가만히 보고만 있을 순 없을 것이다.
Claude Code/Aider는 다행히도 응답을 하고 나서 추가적인 명령을 실행할 수 있는 옵션[2]을 제공해주는데, 거기에 간단하게 echo -ne '\007' 명령어를 넘겨줄 수 있다. 이 명령어는 엄청 어렵지는 않다. 터미널 앱에 내장된 시스템 벨 소리를 재생하는 명령어다.
작업 환경이 어디냐에 따라 다를 순 있겠지만, 작업 완료 여부를 음성으로 받기에는 물리적인 제약이 있을 수 있다. 아예 알림 센터를 이용한다고 치자. 업무 시간대에 방해금지 모드를 설정했다면 알림이 울리게 설정이 했더라도 시스템 제약상 묻힐 가능성도 있다.[3]
visual_bell 옵션을 활용하면, 터미널에 내장된 시스템 벨 소리를 울리는 대신 화면이 반짝이게 해서 다른 에이전트가 응답을 완료했다고 명시적으로 알림을 받을 수 있다. LLM 에이전트가 하는 일을 일일이 모니터링하지 않더라도, 다른 작업을 수행하는 중에 화면이 반짝이면 그때 확인하기만 하면 그만이다.
return {
colors = {
visual_bell = '#003355',
},
visual_bell = {
fade_in_duration_ms = 75,
fade_out_duration_ms = 75,
target = 'BackgroundColor', -- 또는 'CursorColor'
}
}
@kodingwarrior@hackers.pub
이 글(그리고 후속작이 될 글들)은, 내 개발환경에서 자주 사용하고 있고 실제로도 애정하고 있는 도구에 대해서 소개하게 될 것 같다. 내가 어떤 환경에서 개발하고 있는지 궁금한 분들은 내 dotfiles 리포지토리를 참고해도 좋을 것 같다.
dotfiles라는 이름 자체만 보면 뭔가 대단해보일 것 같지만, dotfiles라는 이름 자체는 그냥 단순하다.
.zshrc/.bashrc 같은 것들을 마주하게 될 것이다..gitconfig 같은 파일을 수정하게 될 때가 있다.
git config pull.rebase true 같은 명령어를 실행하는 경우가 더 많을 수 있다. 하지만, 이런 명령어를 실행하면 .gitconfig에도 그대로 기록이 된다.위에서 언급한 예시를 보면 알 수 있겠듯이, 앞에 dot(.)이 붙어있는 설정파일이라면 dotfiles라고 할 수 있겠다. dotfiles 리포지토리를 만들어서 관리를 하는 이유는 무엇인가? 그것은 바로 어떤 환경에서든 .zshrc/.gitignore 파일 같은 것들을 동일하게 사용하여 작업의 흐름을 온전히 유지할 수 있다는 장점이 있기 때문이다. dotfiles를 git과 같은 버전관리 도구로 관리할 수 있고, github 같은 저장소에 올려놓을 수 있다면.... 어떤 개발환경으로 갈아타더라도 github에서 바로 내려받고, 각 설정파일들을 옮기면 그만이기 때문에 개발환경 설정하는데 드는 시간적 비용을 굉장히 아낄 수 있다.
dotfiles를 관리하는 방법들은 여러가지 있겠지만(symbolic link를 이용한다던가 등등), 개인적으로는 chezmoi를 권장하는 바이다. chezmoi는 dotfiles들을 버전관리할 수 있게 편의성을 제공해주는 CLI 도구이다.
chezmoi init https://github.com/malkoG/dotfiles.git 명령을 실행해보면 된다.Wezterm은 Konsole/iTerm2/Gnome Terminal/Alacritty과 같은 터미널 에뮬레이터이며, Rust 기반으로 구축이 되어 있고, GPU 가속을 지원한다. 따라서, 렌더링 자체도 어느 정도는 빠른 편이다.
주변 사람들에게 한번 써보도록 권장하는 터미널 에뮬레이터가 세 가지 정도 있는데, Alacritty/Kitty 그리고 이 글에서 소개하는 Wezterm 정도 된다. 요즘은 Zig 기반으로 만들어진 Ghostty[1]도 추천할만 한 것 같다. 하지만, 이 글에서는 Wezterm을 소개하기로 했기 때문에, Wezterm 중심으로 소개하도록 하겠다.
Wezterm은 다음과 같은 특징을 가진다.
Wezterm을 설치한다면 설치 안내 페이지를 참고해서 설치하면 되는데, 여러분이 Wezterm을 설치했다면 당장은 검은 화면만 뜰지도 모른다.
Wezterm을 설치하고 나서, .config/wezterm/wezterm.lua 파일을 수정해야 하는데, 당장은 아래처럼 비어있을 것이다. 파일이 없다면 만들어두는 것이 좋다.
return {}
위의 코드에서 {}는 lua에서는 테이블(다른 언어로 치면, 딕셔너리/오브젝트 같은 것)이지만, wezterm 터미널의 configuration을 나타내는 테이블이다. 여기에 몇가지 추가사항을 넣어보겠다.
터미널 에뮬레이터를 설치했는데, 터미널 에뮬레이터를 설치했으면 가장 처음부터 하는게 무엇이겠는가? 바로, 폰트를 세팅하는 것이다. 터미널 환경에서 작업할때 폰트만큼 중요한게 또 없다.
local wezterm = require("wezterm")
return {
font = wezterm.font_with_fallback({'Cascadia Code NF', 'NanumBarunGothic'}),
font_size = 12.0,
line_height = 1.2,
}
폰트를 가져다 쓸때는 위의 예시와 같이 font_with_fallback 함수를 이용해서 가져다 쓸 수 있고, 그 외에도 폰트 크기를 지정하거나 행간을 지정할 수도 있다. 공식페이지에서 보았듯이, 여러분의 취향에 따라 배경색 혹은 배경이미지도 지정할 수 있는데 여러분 나름대로의 기준이 있고 욕심이 난다면 한번 도전해보는 것도 나쁘지 않을 것 같다.
위의 코드를 복사 붙여넣고 편집하다보면 느낄 수 있겠지만, wezterm은 설정파일을 편집할때 Hot Reloading을 지원한다. 이 또한, 내가 가장 애정하는 기능 중 하나이다. 혹여나 wezterm 설정 파일을 수정했을때, 문법에 오류가 있거나 설정값을 잘못 지정했을 때, 새 창으로 어떤 부분에 오류가 있는지 친절하게 Alert도 띄워준다.
API 레퍼런스를 보기만 해도 스크립팅으로 기능을 확장할 수 있는 가능성이야 당연히 많긴 하겠지만, 처음 접하는 입장에서는 어떻게 커스터마이징할 지 파악하기 난해할 수 있다.
아래에서는 내가 어떻게 Wezterm을 커스터마이징을 하고 있는지 예시를 나열하는 것으로 글을 끝내겠다. Wezterm, 믿고 써보시라.
Wezterm에서 터미널 색상을 설정할때, 배경색상의 반투명도를 지정할 수 있는 옵션이 있다. 나는 여기서 단축키를 입력했을때 반투명도를 동적으로 조절하고 싶었다.
반투명도를 상수로 둘 수는 있지만, 모니터 하나 짜리의 환경에서 작업한다면 브라우저를 뒤쪽에 두고 터미널 앱을 앞에 두는 식으로 작업을 많이 하게 된다. HMR(Hot Module Reloading)이 되는 개발환경이라면, 소스코드를 편집하고 화면에 즉각적으로 반영이 되는걸 기대할텐데 이걸 탭 스위칭하면서 확인하기는 굉장히 번거롭다. 온전히 작업을 유지하다가 잠깐 확인하고 싶을때 반투명도를 변경하면 되는데도 말이다.
Wezterm에서는 이벤트를 발신할 수 있고, 다른 프로세스에서 특정 이벤트를 수신했을때 어떤 동작을 할 것인지를 정의할 수 있다. Wezterm 터미널 옵션을 수정하는것도 여기에 포함될 수 있다. 특정 단축키를 입력하면, 어떤 이벤트를 발생시킬 수 있고, 그 이벤트로 인해서 화면의 반투명도를 조정할 수 있게 했다.
local default_opacity = 0.9
local keymaps = {}
-- SHIFT + CTRL + Z 키를 누르면 반투명도를 감소시키는 이벤트가 발생한다.
table.insert(
keymaps,
{
key = "Z",
mods = 'SHIFT|CTRL',
action = wezterm.action.EmitEvent 'decrease-opacity',
}
)
-- SHIFT + CTRL + X 키를 누르면 반투명도를 증가시키는 이벤트가 발생한다.
table.insert(
keymaps,
{
key = 'X',
mods = 'SHIFT|CTRL',
action = wezterm.action.EmitEvent 'increase-opacity',
}
)
-- "increase-opacity" 이벤트를 수신했을때, 반투명도를 증가시키는 동작을 하도록 정의한다.
wezterm.on('increase-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
local opacity = overrides.window_background_opacity
if opacity == nil then
opacity = default_opacity
end
opacity = opacity + 0.1
if opacity > 1.0 then
opacity = 1.0
end
overrides.window_background_opacity = opacity
window:set_config_overrides(overrides)
end)
-- "increase-opacity" 이벤트를 수신했을때, 반투명도를 증가시키는 동작을 하도록 정의한다.
wezterm.on('decrease-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
local opacity = overrides.window_background_opacity
if opacity == nil then
opacity = default_opacity
end
opacity = opacity - 0.1
if opacity < 0.3 then
opacity = 0.3
end
overrides.window_background_opacity = opacity
window:set_config_overrides(overrides)
end)
return {
keys = keymaps
}
대부분 터미널 에뮬레이터에서 탭 이름을 표시할때, 현재 탭에서 돌고 있는 프로세스의 이름을 명시할때가 많다. 그런데, 탭에 명시되어 있는 타이틀만 가지고는 각각의 탭이 어떤 역할을 하는 것인지 파악하기 어렵다. 어느 쪽이 서버를 띄우고 있는건지, 어느 쪽이 에디터 편집 화면인지, 어느 쪽이 LLM Agent를 돌리고 있는지 난해하다.
하지만, 아래처럼 wezterm.action.PromptInputLine API를 사용해서 프롬프트 입력을 받은 내용을 기반으로, 현재 활성화된 탭의 이름을 변경하는 식으로 인지부하를 줄일 수 있다.
local wezterm = require('wezterm')
local keymaps = {}
table.insert(
keymaps,
{
key = '`',
mods = 'CTRL',
action = wezterm.action.PromptInputLine {
description = "Enter new name for tab",
action = wezterm.action_callback(function(window, _, line)
if line then
window:active_tab():set_title(line)
end
end)
}
}
)
return {
keys = keymaps
}
Aider나 Claude Code 같은 LLM 에이전트가 작업을 수행 후 아예 작업이 끝났거나, 혹은 작업에 대한 승인을 요구할 때가 간혹 있다. LLM 에이전트가 작업을 수행하는걸 가만히 보고만 있을 순 없을 것이다.
Claude Code/Aider는 다행히도 응답을 하고 나서 추가적인 명령을 실행할 수 있는 옵션[2]을 제공해주는데, 거기에 간단하게 echo -ne '\007' 명령어를 넘겨줄 수 있다. 이 명령어는 엄청 어렵지는 않다. 터미널 앱에 내장된 시스템 벨 소리를 재생하는 명령어다.
작업 환경이 어디냐에 따라 다를 순 있겠지만, 작업 완료 여부를 음성으로 받기에는 물리적인 제약이 있을 수 있다. 아예 알림 센터를 이용한다고 치자. 업무 시간대에 방해금지 모드를 설정했다면 알림이 울리게 설정이 했더라도 시스템 제약상 묻힐 가능성도 있다.[3]
visual_bell 옵션을 활용하면, 터미널에 내장된 시스템 벨 소리를 울리는 대신 화면이 반짝이게 해서 다른 에이전트가 응답을 완료했다고 명시적으로 알림을 받을 수 있다. LLM 에이전트가 하는 일을 일일이 모니터링하지 않더라도, 다른 작업을 수행하는 중에 화면이 반짝이면 그때 확인하기만 하면 그만이다.
return {
colors = {
visual_bell = '#003355',
},
visual_bell = {
fade_in_duration_ms = 75,
fade_out_duration_ms = 75,
target = 'BackgroundColor', -- 또는 'CursorColor'
}
}
@kodingwarrior@hackers.pub
이 글(그리고 후속작이 될 글들)은, 내 개발환경에서 자주 사용하고 있고 실제로도 애정하고 있는 도구에 대해서 소개하게 될 것 같다. 내가 어떤 환경에서 개발하고 있는지 궁금한 분들은 내 dotfiles 리포지토리를 참고해도 좋을 것 같다.
dotfiles라는 이름 자체만 보면 뭔가 대단해보일 것 같지만, dotfiles라는 이름 자체는 그냥 단순하다.
.zshrc/.bashrc 같은 것들을 마주하게 될 것이다..gitconfig 같은 파일을 수정하게 될 때가 있다.
git config pull.rebase true 같은 명령어를 실행하는 경우가 더 많을 수 있다. 하지만, 이런 명령어를 실행하면 .gitconfig에도 그대로 기록이 된다.위에서 언급한 예시를 보면 알 수 있겠듯이, 앞에 dot(.)이 붙어있는 설정파일이라면 dotfiles라고 할 수 있겠다. dotfiles 리포지토리를 만들어서 관리를 하는 이유는 무엇인가? 그것은 바로 어떤 환경에서든 .zshrc/.gitignore 파일 같은 것들을 동일하게 사용하여 작업의 흐름을 온전히 유지할 수 있다는 장점이 있기 때문이다. dotfiles를 git과 같은 버전관리 도구로 관리할 수 있고, github 같은 저장소에 올려놓을 수 있다면.... 어떤 개발환경으로 갈아타더라도 github에서 바로 내려받고, 각 설정파일들을 옮기면 그만이기 때문에 개발환경 설정하는데 드는 시간적 비용을 굉장히 아낄 수 있다.
dotfiles를 관리하는 방법들은 여러가지 있겠지만(symbolic link를 이용한다던가 등등), 개인적으로는 chezmoi를 권장하는 바이다. chezmoi는 dotfiles들을 버전관리할 수 있게 편의성을 제공해주는 CLI 도구이다.
chezmoi init https://github.com/malkoG/dotfiles.git 명령을 실행해보면 된다.Wezterm은 Konsole/iTerm2/Gnome Terminal/Alacritty과 같은 터미널 에뮬레이터이며, Rust 기반으로 구축이 되어 있고, GPU 가속을 지원한다. 따라서, 렌더링 자체도 어느 정도는 빠른 편이다.
주변 사람들에게 한번 써보도록 권장하는 터미널 에뮬레이터가 세 가지 정도 있는데, Alacritty/Kitty 그리고 이 글에서 소개하는 Wezterm 정도 된다. 요즘은 Zig 기반으로 만들어진 Ghostty[1]도 추천할만 한 것 같다. 하지만, 이 글에서는 Wezterm을 소개하기로 했기 때문에, Wezterm 중심으로 소개하도록 하겠다.
Wezterm은 다음과 같은 특징을 가진다.
Wezterm을 설치한다면 설치 안내 페이지를 참고해서 설치하면 되는데, 여러분이 Wezterm을 설치했다면 당장은 검은 화면만 뜰지도 모른다.
Wezterm을 설치하고 나서, .config/wezterm/wezterm.lua 파일을 수정해야 하는데, 당장은 아래처럼 비어있을 것이다. 파일이 없다면 만들어두는 것이 좋다.
return {}
위의 코드에서 {}는 lua에서는 테이블(다른 언어로 치면, 딕셔너리/오브젝트 같은 것)이지만, wezterm 터미널의 configuration을 나타내는 테이블이다. 여기에 몇가지 추가사항을 넣어보겠다.
터미널 에뮬레이터를 설치했는데, 터미널 에뮬레이터를 설치했으면 가장 처음부터 하는게 무엇이겠는가? 바로, 폰트를 세팅하는 것이다. 터미널 환경에서 작업할때 폰트만큼 중요한게 또 없다.
local wezterm = require("wezterm")
return {
font = wezterm.font_with_fallback({'Cascadia Code NF', 'NanumBarunGothic'}),
font_size = 12.0,
line_height = 1.2,
}
폰트를 가져다 쓸때는 위의 예시와 같이 font_with_fallback 함수를 이용해서 가져다 쓸 수 있고, 그 외에도 폰트 크기를 지정하거나 행간을 지정할 수도 있다. 공식페이지에서 보았듯이, 여러분의 취향에 따라 배경색 혹은 배경이미지도 지정할 수 있는데 여러분 나름대로의 기준이 있고 욕심이 난다면 한번 도전해보는 것도 나쁘지 않을 것 같다.
위의 코드를 복사 붙여넣고 편집하다보면 느낄 수 있겠지만, wezterm은 설정파일을 편집할때 Hot Reloading을 지원한다. 이 또한, 내가 가장 애정하는 기능 중 하나이다. 혹여나 wezterm 설정 파일을 수정했을때, 문법에 오류가 있거나 설정값을 잘못 지정했을 때, 새 창으로 어떤 부분에 오류가 있는지 친절하게 Alert도 띄워준다.
API 레퍼런스를 보기만 해도 스크립팅으로 기능을 확장할 수 있는 가능성이야 당연히 많긴 하겠지만, 처음 접하는 입장에서는 어떻게 커스터마이징할 지 파악하기 난해할 수 있다.
아래에서는 내가 어떻게 Wezterm을 커스터마이징을 하고 있는지 예시를 나열하는 것으로 글을 끝내겠다. Wezterm, 믿고 써보시라.
Wezterm에서 터미널 색상을 설정할때, 배경색상의 반투명도를 지정할 수 있는 옵션이 있다. 나는 여기서 단축키를 입력했을때 반투명도를 동적으로 조절하고 싶었다.
반투명도를 상수로 둘 수는 있지만, 모니터 하나 짜리의 환경에서 작업한다면 브라우저를 뒤쪽에 두고 터미널 앱을 앞에 두는 식으로 작업을 많이 하게 된다. HMR(Hot Module Reloading)이 되는 개발환경이라면, 소스코드를 편집하고 화면에 즉각적으로 반영이 되는걸 기대할텐데 이걸 탭 스위칭하면서 확인하기는 굉장히 번거롭다. 온전히 작업을 유지하다가 잠깐 확인하고 싶을때 반투명도를 변경하면 되는데도 말이다.
Wezterm에서는 이벤트를 발신할 수 있고, 다른 프로세스에서 특정 이벤트를 수신했을때 어떤 동작을 할 것인지를 정의할 수 있다. Wezterm 터미널 옵션을 수정하는것도 여기에 포함될 수 있다. 특정 단축키를 입력하면, 어떤 이벤트를 발생시킬 수 있고, 그 이벤트로 인해서 화면의 반투명도를 조정할 수 있게 했다.
local default_opacity = 0.9
local keymaps = {}
-- SHIFT + CTRL + Z 키를 누르면 반투명도를 감소시키는 이벤트가 발생한다.
table.insert(
keymaps,
{
key = "Z",
mods = 'SHIFT|CTRL',
action = wezterm.action.EmitEvent 'decrease-opacity',
}
)
-- SHIFT + CTRL + X 키를 누르면 반투명도를 증가시키는 이벤트가 발생한다.
table.insert(
keymaps,
{
key = 'X',
mods = 'SHIFT|CTRL',
action = wezterm.action.EmitEvent 'increase-opacity',
}
)
-- "increase-opacity" 이벤트를 수신했을때, 반투명도를 증가시키는 동작을 하도록 정의한다.
wezterm.on('increase-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
local opacity = overrides.window_background_opacity
if opacity == nil then
opacity = default_opacity
end
opacity = opacity + 0.1
if opacity > 1.0 then
opacity = 1.0
end
overrides.window_background_opacity = opacity
window:set_config_overrides(overrides)
end)
-- "increase-opacity" 이벤트를 수신했을때, 반투명도를 증가시키는 동작을 하도록 정의한다.
wezterm.on('decrease-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
local opacity = overrides.window_background_opacity
if opacity == nil then
opacity = default_opacity
end
opacity = opacity - 0.1
if opacity < 0.3 then
opacity = 0.3
end
overrides.window_background_opacity = opacity
window:set_config_overrides(overrides)
end)
return {
keys = keymaps
}
대부분 터미널 에뮬레이터에서 탭 이름을 표시할때, 현재 탭에서 돌고 있는 프로세스의 이름을 명시할때가 많다. 그런데, 탭에 명시되어 있는 타이틀만 가지고는 각각의 탭이 어떤 역할을 하는 것인지 파악하기 어렵다. 어느 쪽이 서버를 띄우고 있는건지, 어느 쪽이 에디터 편집 화면인지, 어느 쪽이 LLM Agent를 돌리고 있는지 난해하다.
하지만, 아래처럼 wezterm.action.PromptInputLine API를 사용해서 프롬프트 입력을 받은 내용을 기반으로, 현재 활성화된 탭의 이름을 변경하는 식으로 인지부하를 줄일 수 있다.
local wezterm = require('wezterm')
local keymaps = {}
table.insert(
keymaps,
{
key = '`',
mods = 'CTRL',
action = wezterm.action.PromptInputLine {
description = "Enter new name for tab",
action = wezterm.action_callback(function(window, _, line)
if line then
window:active_tab():set_title(line)
end
end)
}
}
)
return {
keys = keymaps
}
Aider나 Claude Code 같은 LLM 에이전트가 작업을 수행 후 아예 작업이 끝났거나, 혹은 작업에 대한 승인을 요구할 때가 간혹 있다. LLM 에이전트가 작업을 수행하는걸 가만히 보고만 있을 순 없을 것이다.
Claude Code/Aider는 다행히도 응답을 하고 나서 추가적인 명령을 실행할 수 있는 옵션[2]을 제공해주는데, 거기에 간단하게 echo -ne '\007' 명령어를 넘겨줄 수 있다. 이 명령어는 엄청 어렵지는 않다. 터미널 앱에 내장된 시스템 벨 소리를 재생하는 명령어다.
작업 환경이 어디냐에 따라 다를 순 있겠지만, 작업 완료 여부를 음성으로 받기에는 물리적인 제약이 있을 수 있다. 아예 알림 센터를 이용한다고 치자. 업무 시간대에 방해금지 모드를 설정했다면 알림이 울리게 설정이 했더라도 시스템 제약상 묻힐 가능성도 있다.[3]
visual_bell 옵션을 활용하면, 터미널에 내장된 시스템 벨 소리를 울리는 대신 화면이 반짝이게 해서 다른 에이전트가 응답을 완료했다고 명시적으로 알림을 받을 수 있다. LLM 에이전트가 하는 일을 일일이 모니터링하지 않더라도, 다른 작업을 수행하는 중에 화면이 반짝이면 그때 확인하기만 하면 그만이다.
return {
colors = {
visual_bell = '#003355',
},
visual_bell = {
fade_in_duration_ms = 75,
fade_out_duration_ms = 75,
target = 'BackgroundColor', -- 또는 'CursorColor'
}
}
@kodingwarrior@hackers.pub
이 글(그리고 후속작이 될 글들)은, 내 개발환경에서 자주 사용하고 있고 실제로도 애정하고 있는 도구에 대해서 소개하게 될 것 같다. 내가 어떤 환경에서 개발하고 있는지 궁금한 분들은 내 dotfiles 리포지토리를 참고해도 좋을 것 같다.
dotfiles라는 이름 자체만 보면 뭔가 대단해보일 것 같지만, dotfiles라는 이름 자체는 그냥 단순하다.
.zshrc/.bashrc 같은 것들을 마주하게 될 것이다..gitconfig 같은 파일을 수정하게 될 때가 있다.
git config pull.rebase true 같은 명령어를 실행하는 경우가 더 많을 수 있다. 하지만, 이런 명령어를 실행하면 .gitconfig에도 그대로 기록이 된다.위에서 언급한 예시를 보면 알 수 있겠듯이, 앞에 dot(.)이 붙어있는 설정파일이라면 dotfiles라고 할 수 있겠다. dotfiles 리포지토리를 만들어서 관리를 하는 이유는 무엇인가? 그것은 바로 어떤 환경에서든 .zshrc/.gitignore 파일 같은 것들을 동일하게 사용하여 작업의 흐름을 온전히 유지할 수 있다는 장점이 있기 때문이다. dotfiles를 git과 같은 버전관리 도구로 관리할 수 있고, github 같은 저장소에 올려놓을 수 있다면.... 어떤 개발환경으로 갈아타더라도 github에서 바로 내려받고, 각 설정파일들을 옮기면 그만이기 때문에 개발환경 설정하는데 드는 시간적 비용을 굉장히 아낄 수 있다.
dotfiles를 관리하는 방법들은 여러가지 있겠지만(symbolic link를 이용한다던가 등등), 개인적으로는 chezmoi를 권장하는 바이다. chezmoi는 dotfiles들을 버전관리할 수 있게 편의성을 제공해주는 CLI 도구이다.
chezmoi init https://github.com/malkoG/dotfiles.git 명령을 실행해보면 된다.Wezterm은 Konsole/iTerm2/Gnome Terminal/Alacritty과 같은 터미널 에뮬레이터이며, Rust 기반으로 구축이 되어 있고, GPU 가속을 지원한다. 따라서, 렌더링 자체도 어느 정도는 빠른 편이다.
주변 사람들에게 한번 써보도록 권장하는 터미널 에뮬레이터가 세 가지 정도 있는데, Alacritty/Kitty 그리고 이 글에서 소개하는 Wezterm 정도 된다. 요즘은 Zig 기반으로 만들어진 Ghostty[1]도 추천할만 한 것 같다. 하지만, 이 글에서는 Wezterm을 소개하기로 했기 때문에, Wezterm 중심으로 소개하도록 하겠다.
Wezterm은 다음과 같은 특징을 가진다.
Wezterm을 설치한다면 설치 안내 페이지를 참고해서 설치하면 되는데, 여러분이 Wezterm을 설치했다면 당장은 검은 화면만 뜰지도 모른다.
Wezterm을 설치하고 나서, .config/wezterm/wezterm.lua 파일을 수정해야 하는데, 당장은 아래처럼 비어있을 것이다. 파일이 없다면 만들어두는 것이 좋다.
return {}
위의 코드에서 {}는 lua에서는 테이블(다른 언어로 치면, 딕셔너리/오브젝트 같은 것)이지만, wezterm 터미널의 configuration을 나타내는 테이블이다. 여기에 몇가지 추가사항을 넣어보겠다.
터미널 에뮬레이터를 설치했는데, 터미널 에뮬레이터를 설치했으면 가장 처음부터 하는게 무엇이겠는가? 바로, 폰트를 세팅하는 것이다. 터미널 환경에서 작업할때 폰트만큼 중요한게 또 없다.
local wezterm = require("wezterm")
return {
font = wezterm.font_with_fallback({'Cascadia Code NF', 'NanumBarunGothic'}),
font_size = 12.0,
line_height = 1.2,
}
폰트를 가져다 쓸때는 위의 예시와 같이 font_with_fallback 함수를 이용해서 가져다 쓸 수 있고, 그 외에도 폰트 크기를 지정하거나 행간을 지정할 수도 있다. 공식페이지에서 보았듯이, 여러분의 취향에 따라 배경색 혹은 배경이미지도 지정할 수 있는데 여러분 나름대로의 기준이 있고 욕심이 난다면 한번 도전해보는 것도 나쁘지 않을 것 같다.
위의 코드를 복사 붙여넣고 편집하다보면 느낄 수 있겠지만, wezterm은 설정파일을 편집할때 Hot Reloading을 지원한다. 이 또한, 내가 가장 애정하는 기능 중 하나이다. 혹여나 wezterm 설정 파일을 수정했을때, 문법에 오류가 있거나 설정값을 잘못 지정했을 때, 새 창으로 어떤 부분에 오류가 있는지 친절하게 Alert도 띄워준다.
API 레퍼런스를 보기만 해도 스크립팅으로 기능을 확장할 수 있는 가능성이야 당연히 많긴 하겠지만, 처음 접하는 입장에서는 어떻게 커스터마이징할 지 파악하기 난해할 수 있다.
아래에서는 내가 어떻게 Wezterm을 커스터마이징을 하고 있는지 예시를 나열하는 것으로 글을 끝내겠다. Wezterm, 믿고 써보시라.
Wezterm에서 터미널 색상을 설정할때, 배경색상의 반투명도를 지정할 수 있는 옵션이 있다. 나는 여기서 단축키를 입력했을때 반투명도를 동적으로 조절하고 싶었다.
반투명도를 상수로 둘 수는 있지만, 모니터 하나 짜리의 환경에서 작업한다면 브라우저를 뒤쪽에 두고 터미널 앱을 앞에 두는 식으로 작업을 많이 하게 된다. HMR(Hot Module Reloading)이 되는 개발환경이라면, 소스코드를 편집하고 화면에 즉각적으로 반영이 되는걸 기대할텐데 이걸 탭 스위칭하면서 확인하기는 굉장히 번거롭다. 온전히 작업을 유지하다가 잠깐 확인하고 싶을때 반투명도를 변경하면 되는데도 말이다.
Wezterm에서는 이벤트를 발신할 수 있고, 다른 프로세스에서 특정 이벤트를 수신했을때 어떤 동작을 할 것인지를 정의할 수 있다. Wezterm 터미널 옵션을 수정하는것도 여기에 포함될 수 있다. 특정 단축키를 입력하면, 어떤 이벤트를 발생시킬 수 있고, 그 이벤트로 인해서 화면의 반투명도를 조정할 수 있게 했다.
local default_opacity = 0.9
local keymaps = {}
-- SHIFT + CTRL + Z 키를 누르면 반투명도를 감소시키는 이벤트가 발생한다.
table.insert(
keymaps,
{
key = "Z",
mods = 'SHIFT|CTRL',
action = wezterm.action.EmitEvent 'decrease-opacity',
}
)
-- SHIFT + CTRL + X 키를 누르면 반투명도를 증가시키는 이벤트가 발생한다.
table.insert(
keymaps,
{
key = 'X',
mods = 'SHIFT|CTRL',
action = wezterm.action.EmitEvent 'increase-opacity',
}
)
-- "increase-opacity" 이벤트를 수신했을때, 반투명도를 증가시키는 동작을 하도록 정의한다.
wezterm.on('increase-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
local opacity = overrides.window_background_opacity
if opacity == nil then
opacity = default_opacity
end
opacity = opacity + 0.1
if opacity > 1.0 then
opacity = 1.0
end
overrides.window_background_opacity = opacity
window:set_config_overrides(overrides)
end)
-- "increase-opacity" 이벤트를 수신했을때, 반투명도를 증가시키는 동작을 하도록 정의한다.
wezterm.on('decrease-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
local opacity = overrides.window_background_opacity
if opacity == nil then
opacity = default_opacity
end
opacity = opacity - 0.1
if opacity < 0.3 then
opacity = 0.3
end
overrides.window_background_opacity = opacity
window:set_config_overrides(overrides)
end)
return {
keys = keymaps
}
대부분 터미널 에뮬레이터에서 탭 이름을 표시할때, 현재 탭에서 돌고 있는 프로세스의 이름을 명시할때가 많다. 그런데, 탭에 명시되어 있는 타이틀만 가지고는 각각의 탭이 어떤 역할을 하는 것인지 파악하기 어렵다. 어느 쪽이 서버를 띄우고 있는건지, 어느 쪽이 에디터 편집 화면인지, 어느 쪽이 LLM Agent를 돌리고 있는지 난해하다.
하지만, 아래처럼 wezterm.action.PromptInputLine API를 사용해서 프롬프트 입력을 받은 내용을 기반으로, 현재 활성화된 탭의 이름을 변경하는 식으로 인지부하를 줄일 수 있다.
local wezterm = require('wezterm')
local keymaps = {}
table.insert(
keymaps,
{
key = '`',
mods = 'CTRL',
action = wezterm.action.PromptInputLine {
description = "Enter new name for tab",
action = wezterm.action_callback(function(window, _, line)
if line then
window:active_tab():set_title(line)
end
end)
}
}
)
return {
keys = keymaps
}
Aider나 Claude Code 같은 LLM 에이전트가 작업을 수행 후 아예 작업이 끝났거나, 혹은 작업에 대한 승인을 요구할 때가 간혹 있다. LLM 에이전트가 작업을 수행하는걸 가만히 보고만 있을 순 없을 것이다.
Claude Code/Aider는 다행히도 응답을 하고 나서 추가적인 명령을 실행할 수 있는 옵션[2]을 제공해주는데, 거기에 간단하게 echo -ne '\007' 명령어를 넘겨줄 수 있다. 이 명령어는 엄청 어렵지는 않다. 터미널 앱에 내장된 시스템 벨 소리를 재생하는 명령어다.
작업 환경이 어디냐에 따라 다를 순 있겠지만, 작업 완료 여부를 음성으로 받기에는 물리적인 제약이 있을 수 있다. 아예 알림 센터를 이용한다고 치자. 업무 시간대에 방해금지 모드를 설정했다면 알림이 울리게 설정이 했더라도 시스템 제약상 묻힐 가능성도 있다.[3]
visual_bell 옵션을 활용하면, 터미널에 내장된 시스템 벨 소리를 울리는 대신 화면이 반짝이게 해서 다른 에이전트가 응답을 완료했다고 명시적으로 알림을 받을 수 있다. LLM 에이전트가 하는 일을 일일이 모니터링하지 않더라도, 다른 작업을 수행하는 중에 화면이 반짝이면 그때 확인하기만 하면 그만이다.
return {
colors = {
visual_bell = '#003355',
},
visual_bell = {
fade_in_duration_ms = 75,
fade_out_duration_ms = 75,
target = 'BackgroundColor', -- 또는 'CursorColor'
}
}
@kodingwarrior@hackers.pub
이 글(그리고 후속작이 될 글들)은, 내 개발환경에서 자주 사용하고 있고 실제로도 애정하고 있는 도구에 대해서 소개하게 될 것 같다. 내가 어떤 환경에서 개발하고 있는지 궁금한 분들은 내 dotfiles 리포지토리를 참고해도 좋을 것 같다.
dotfiles라는 이름 자체만 보면 뭔가 대단해보일 것 같지만, dotfiles라는 이름 자체는 그냥 단순하다.
.zshrc/.bashrc 같은 것들을 마주하게 될 것이다..gitconfig 같은 파일을 수정하게 될 때가 있다.
git config pull.rebase true 같은 명령어를 실행하는 경우가 더 많을 수 있다. 하지만, 이런 명령어를 실행하면 .gitconfig에도 그대로 기록이 된다.위에서 언급한 예시를 보면 알 수 있겠듯이, 앞에 dot(.)이 붙어있는 설정파일이라면 dotfiles라고 할 수 있겠다. dotfiles 리포지토리를 만들어서 관리를 하는 이유는 무엇인가? 그것은 바로 어떤 환경에서든 .zshrc/.gitignore 파일 같은 것들을 동일하게 사용하여 작업의 흐름을 온전히 유지할 수 있다는 장점이 있기 때문이다. dotfiles를 git과 같은 버전관리 도구로 관리할 수 있고, github 같은 저장소에 올려놓을 수 있다면.... 어떤 개발환경으로 갈아타더라도 github에서 바로 내려받고, 각 설정파일들을 옮기면 그만이기 때문에 개발환경 설정하는데 드는 시간적 비용을 굉장히 아낄 수 있다.
dotfiles를 관리하는 방법들은 여러가지 있겠지만(symbolic link를 이용한다던가 등등), 개인적으로는 chezmoi를 권장하는 바이다. chezmoi는 dotfiles들을 버전관리할 수 있게 편의성을 제공해주는 CLI 도구이다.
chezmoi init https://github.com/malkoG/dotfiles.git 명령을 실행해보면 된다.Wezterm은 Konsole/iTerm2/Gnome Terminal/Alacritty과 같은 터미널 에뮬레이터이며, Rust 기반으로 구축이 되어 있고, GPU 가속을 지원한다. 따라서, 렌더링 자체도 어느 정도는 빠른 편이다.
주변 사람들에게 한번 써보도록 권장하는 터미널 에뮬레이터가 세 가지 정도 있는데, Alacritty/Kitty 그리고 이 글에서 소개하는 Wezterm 정도 된다. 요즘은 Zig 기반으로 만들어진 Ghostty[1]도 추천할만 한 것 같다. 하지만, 이 글에서는 Wezterm을 소개하기로 했기 때문에, Wezterm 중심으로 소개하도록 하겠다.
Wezterm은 다음과 같은 특징을 가진다.
Wezterm을 설치한다면 설치 안내 페이지를 참고해서 설치하면 되는데, 여러분이 Wezterm을 설치했다면 당장은 검은 화면만 뜰지도 모른다.
Wezterm을 설치하고 나서, .config/wezterm/wezterm.lua 파일을 수정해야 하는데, 당장은 아래처럼 비어있을 것이다. 파일이 없다면 만들어두는 것이 좋다.
return {}
위의 코드에서 {}는 lua에서는 테이블(다른 언어로 치면, 딕셔너리/오브젝트 같은 것)이지만, wezterm 터미널의 configuration을 나타내는 테이블이다. 여기에 몇가지 추가사항을 넣어보겠다.
터미널 에뮬레이터를 설치했는데, 터미널 에뮬레이터를 설치했으면 가장 처음부터 하는게 무엇이겠는가? 바로, 폰트를 세팅하는 것이다. 터미널 환경에서 작업할때 폰트만큼 중요한게 또 없다.
local wezterm = require("wezterm")
return {
font = wezterm.font_with_fallback({'Cascadia Code NF', 'NanumBarunGothic'}),
font_size = 12.0,
line_height = 1.2,
}
폰트를 가져다 쓸때는 위의 예시와 같이 font_with_fallback 함수를 이용해서 가져다 쓸 수 있고, 그 외에도 폰트 크기를 지정하거나 행간을 지정할 수도 있다. 공식페이지에서 보았듯이, 여러분의 취향에 따라 배경색 혹은 배경이미지도 지정할 수 있는데 여러분 나름대로의 기준이 있고 욕심이 난다면 한번 도전해보는 것도 나쁘지 않을 것 같다.
위의 코드를 복사 붙여넣고 편집하다보면 느낄 수 있겠지만, wezterm은 설정파일을 편집할때 Hot Reloading을 지원한다. 이 또한, 내가 가장 애정하는 기능 중 하나이다. 혹여나 wezterm 설정 파일을 수정했을때, 문법에 오류가 있거나 설정값을 잘못 지정했을 때, 새 창으로 어떤 부분에 오류가 있는지 친절하게 Alert도 띄워준다.
API 레퍼런스를 보기만 해도 스크립팅으로 기능을 확장할 수 있는 가능성이야 당연히 많긴 하겠지만, 처음 접하는 입장에서는 어떻게 커스터마이징할 지 파악하기 난해할 수 있다.
아래에서는 내가 어떻게 Wezterm을 커스터마이징을 하고 있는지 예시를 나열하는 것으로 글을 끝내겠다. Wezterm, 믿고 써보시라.
Wezterm에서 터미널 색상을 설정할때, 배경색상의 반투명도를 지정할 수 있는 옵션이 있다. 나는 여기서 단축키를 입력했을때 반투명도를 동적으로 조절하고 싶었다.
반투명도를 상수로 둘 수는 있지만, 모니터 하나 짜리의 환경에서 작업한다면 브라우저를 뒤쪽에 두고 터미널 앱을 앞에 두는 식으로 작업을 많이 하게 된다. HMR(Hot Module Reloading)이 되는 개발환경이라면, 소스코드를 편집하고 화면에 즉각적으로 반영이 되는걸 기대할텐데 이걸 탭 스위칭하면서 확인하기는 굉장히 번거롭다. 온전히 작업을 유지하다가 잠깐 확인하고 싶을때 반투명도를 변경하면 되는데도 말이다.
Wezterm에서는 이벤트를 발신할 수 있고, 다른 프로세스에서 특정 이벤트를 수신했을때 어떤 동작을 할 것인지를 정의할 수 있다. Wezterm 터미널 옵션을 수정하는것도 여기에 포함될 수 있다. 특정 단축키를 입력하면, 어떤 이벤트를 발생시킬 수 있고, 그 이벤트로 인해서 화면의 반투명도를 조정할 수 있게 했다.
local default_opacity = 0.9
local keymaps = {}
-- SHIFT + CTRL + Z 키를 누르면 반투명도를 감소시키는 이벤트가 발생한다.
table.insert(
keymaps,
{
key = "Z",
mods = 'SHIFT|CTRL',
action = wezterm.action.EmitEvent 'decrease-opacity',
}
)
-- SHIFT + CTRL + X 키를 누르면 반투명도를 증가시키는 이벤트가 발생한다.
table.insert(
keymaps,
{
key = 'X',
mods = 'SHIFT|CTRL',
action = wezterm.action.EmitEvent 'increase-opacity',
}
)
-- "increase-opacity" 이벤트를 수신했을때, 반투명도를 증가시키는 동작을 하도록 정의한다.
wezterm.on('increase-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
local opacity = overrides.window_background_opacity
if opacity == nil then
opacity = default_opacity
end
opacity = opacity + 0.1
if opacity > 1.0 then
opacity = 1.0
end
overrides.window_background_opacity = opacity
window:set_config_overrides(overrides)
end)
-- "increase-opacity" 이벤트를 수신했을때, 반투명도를 증가시키는 동작을 하도록 정의한다.
wezterm.on('decrease-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
local opacity = overrides.window_background_opacity
if opacity == nil then
opacity = default_opacity
end
opacity = opacity - 0.1
if opacity < 0.3 then
opacity = 0.3
end
overrides.window_background_opacity = opacity
window:set_config_overrides(overrides)
end)
return {
keys = keymaps
}
대부분 터미널 에뮬레이터에서 탭 이름을 표시할때, 현재 탭에서 돌고 있는 프로세스의 이름을 명시할때가 많다. 그런데, 탭에 명시되어 있는 타이틀만 가지고는 각각의 탭이 어떤 역할을 하는 것인지 파악하기 어렵다. 어느 쪽이 서버를 띄우고 있는건지, 어느 쪽이 에디터 편집 화면인지, 어느 쪽이 LLM Agent를 돌리고 있는지 난해하다.
하지만, 아래처럼 wezterm.action.PromptInputLine API를 사용해서 프롬프트 입력을 받은 내용을 기반으로, 현재 활성화된 탭의 이름을 변경하는 식으로 인지부하를 줄일 수 있다.
local wezterm = require('wezterm')
local keymaps = {}
table.insert(
keymaps,
{
key = '`',
mods = 'CTRL',
action = wezterm.action.PromptInputLine {
description = "Enter new name for tab",
action = wezterm.action_callback(function(window, _, line)
if line then
window:active_tab():set_title(line)
end
end)
}
}
)
return {
keys = keymaps
}
Aider나 Claude Code 같은 LLM 에이전트가 작업을 수행 후 아예 작업이 끝났거나, 혹은 작업에 대한 승인을 요구할 때가 간혹 있다. LLM 에이전트가 작업을 수행하는걸 가만히 보고만 있을 순 없을 것이다.
Claude Code/Aider는 다행히도 응답을 하고 나서 추가적인 명령을 실행할 수 있는 옵션[2]을 제공해주는데, 거기에 간단하게 echo -ne '\007' 명령어를 넘겨줄 수 있다. 이 명령어는 엄청 어렵지는 않다. 터미널 앱에 내장된 시스템 벨 소리를 재생하는 명령어다.
작업 환경이 어디냐에 따라 다를 순 있겠지만, 작업 완료 여부를 음성으로 받기에는 물리적인 제약이 있을 수 있다. 아예 알림 센터를 이용한다고 치자. 업무 시간대에 방해금지 모드를 설정했다면 알림이 울리게 설정이 했더라도 시스템 제약상 묻힐 가능성도 있다.[3]
visual_bell 옵션을 활용하면, 터미널에 내장된 시스템 벨 소리를 울리는 대신 화면이 반짝이게 해서 다른 에이전트가 응답을 완료했다고 명시적으로 알림을 받을 수 있다. LLM 에이전트가 하는 일을 일일이 모니터링하지 않더라도, 다른 작업을 수행하는 중에 화면이 반짝이면 그때 확인하기만 하면 그만이다.
return {
colors = {
visual_bell = '#003355',
},
visual_bell = {
fade_in_duration_ms = 75,
fade_out_duration_ms = 75,
target = 'BackgroundColor', -- 또는 'CursorColor'
}
}
@kodingwarrior@hackers.pub
이 글(그리고 후속작이 될 글들)은, 내 개발환경에서 자주 사용하고 있고 실제로도 애정하고 있는 도구에 대해서 소개하게 될 것 같다. 내가 어떤 환경에서 개발하고 있는지 궁금한 분들은 내 dotfiles 리포지토리를 참고해도 좋을 것 같다.
dotfiles라는 이름 자체만 보면 뭔가 대단해보일 것 같지만, dotfiles라는 이름 자체는 그냥 단순하다.
.zshrc/.bashrc 같은 것들을 마주하게 될 것이다..gitconfig 같은 파일을 수정하게 될 때가 있다.
git config pull.rebase true 같은 명령어를 실행하는 경우가 더 많을 수 있다. 하지만, 이런 명령어를 실행하면 .gitconfig에도 그대로 기록이 된다.위에서 언급한 예시를 보면 알 수 있겠듯이, 앞에 dot(.)이 붙어있는 설정파일이라면 dotfiles라고 할 수 있겠다. dotfiles 리포지토리를 만들어서 관리를 하는 이유는 무엇인가? 그것은 바로 어떤 환경에서든 .zshrc/.gitignore 파일 같은 것들을 동일하게 사용하여 작업의 흐름을 온전히 유지할 수 있다는 장점이 있기 때문이다. dotfiles를 git과 같은 버전관리 도구로 관리할 수 있고, github 같은 저장소에 올려놓을 수 있다면.... 어떤 개발환경으로 갈아타더라도 github에서 바로 내려받고, 각 설정파일들을 옮기면 그만이기 때문에 개발환경 설정하는데 드는 시간적 비용을 굉장히 아낄 수 있다.
dotfiles를 관리하는 방법들은 여러가지 있겠지만(symbolic link를 이용한다던가 등등), 개인적으로는 chezmoi를 권장하는 바이다. chezmoi는 dotfiles들을 버전관리할 수 있게 편의성을 제공해주는 CLI 도구이다.
chezmoi init https://github.com/malkoG/dotfiles.git 명령을 실행해보면 된다.Wezterm은 Konsole/iTerm2/Gnome Terminal/Alacritty과 같은 터미널 에뮬레이터이며, Rust 기반으로 구축이 되어 있고, GPU 가속을 지원한다. 따라서, 렌더링 자체도 어느 정도는 빠른 편이다.
주변 사람들에게 한번 써보도록 권장하는 터미널 에뮬레이터가 세 가지 정도 있는데, Alacritty/Kitty 그리고 이 글에서 소개하는 Wezterm 정도 된다. 요즘은 Zig 기반으로 만들어진 Ghostty[1]도 추천할만 한 것 같다. 하지만, 이 글에서는 Wezterm을 소개하기로 했기 때문에, Wezterm 중심으로 소개하도록 하겠다.
Wezterm은 다음과 같은 특징을 가진다.
Wezterm을 설치한다면 설치 안내 페이지를 참고해서 설치하면 되는데, 여러분이 Wezterm을 설치했다면 당장은 검은 화면만 뜰지도 모른다.
Wezterm을 설치하고 나서, .config/wezterm/wezterm.lua 파일을 수정해야 하는데, 당장은 아래처럼 비어있을 것이다. 파일이 없다면 만들어두는 것이 좋다.
return {}
위의 코드에서 {}는 lua에서는 테이블(다른 언어로 치면, 딕셔너리/오브젝트 같은 것)이지만, wezterm 터미널의 configuration을 나타내는 테이블이다. 여기에 몇가지 추가사항을 넣어보겠다.
터미널 에뮬레이터를 설치했는데, 터미널 에뮬레이터를 설치했으면 가장 처음부터 하는게 무엇이겠는가? 바로, 폰트를 세팅하는 것이다. 터미널 환경에서 작업할때 폰트만큼 중요한게 또 없다.
local wezterm = require("wezterm")
return {
font = wezterm.font_with_fallback({'Cascadia Code NF', 'NanumBarunGothic'}),
font_size = 12.0,
line_height = 1.2,
}
폰트를 가져다 쓸때는 위의 예시와 같이 font_with_fallback 함수를 이용해서 가져다 쓸 수 있고, 그 외에도 폰트 크기를 지정하거나 행간을 지정할 수도 있다. 공식페이지에서 보았듯이, 여러분의 취향에 따라 배경색 혹은 배경이미지도 지정할 수 있는데 여러분 나름대로의 기준이 있고 욕심이 난다면 한번 도전해보는 것도 나쁘지 않을 것 같다.
위의 코드를 복사 붙여넣고 편집하다보면 느낄 수 있겠지만, wezterm은 설정파일을 편집할때 Hot Reloading을 지원한다. 이 또한, 내가 가장 애정하는 기능 중 하나이다. 혹여나 wezterm 설정 파일을 수정했을때, 문법에 오류가 있거나 설정값을 잘못 지정했을 때, 새 창으로 어떤 부분에 오류가 있는지 친절하게 Alert도 띄워준다.
API 레퍼런스를 보기만 해도 스크립팅으로 기능을 확장할 수 있는 가능성이야 당연히 많긴 하겠지만, 처음 접하는 입장에서는 어떻게 커스터마이징할 지 파악하기 난해할 수 있다.
아래에서는 내가 어떻게 Wezterm을 커스터마이징을 하고 있는지 예시를 나열하는 것으로 글을 끝내겠다. Wezterm, 믿고 써보시라.
Wezterm에서 터미널 색상을 설정할때, 배경색상의 반투명도를 지정할 수 있는 옵션이 있다. 나는 여기서 단축키를 입력했을때 반투명도를 동적으로 조절하고 싶었다.
반투명도를 상수로 둘 수는 있지만, 모니터 하나 짜리의 환경에서 작업한다면 브라우저를 뒤쪽에 두고 터미널 앱을 앞에 두는 식으로 작업을 많이 하게 된다. HMR(Hot Module Reloading)이 되는 개발환경이라면, 소스코드를 편집하고 화면에 즉각적으로 반영이 되는걸 기대할텐데 이걸 탭 스위칭하면서 확인하기는 굉장히 번거롭다. 온전히 작업을 유지하다가 잠깐 확인하고 싶을때 반투명도를 변경하면 되는데도 말이다.
Wezterm에서는 이벤트를 발신할 수 있고, 다른 프로세스에서 특정 이벤트를 수신했을때 어떤 동작을 할 것인지를 정의할 수 있다. Wezterm 터미널 옵션을 수정하는것도 여기에 포함될 수 있다. 특정 단축키를 입력하면, 어떤 이벤트를 발생시킬 수 있고, 그 이벤트로 인해서 화면의 반투명도를 조정할 수 있게 했다.
local default_opacity = 0.9
local keymaps = {}
-- SHIFT + CTRL + Z 키를 누르면 반투명도를 감소시키는 이벤트가 발생한다.
table.insert(
keymaps,
{
key = "Z",
mods = 'SHIFT|CTRL',
action = wezterm.action.EmitEvent 'decrease-opacity',
}
)
-- SHIFT + CTRL + X 키를 누르면 반투명도를 증가시키는 이벤트가 발생한다.
table.insert(
keymaps,
{
key = 'X',
mods = 'SHIFT|CTRL',
action = wezterm.action.EmitEvent 'increase-opacity',
}
)
-- "increase-opacity" 이벤트를 수신했을때, 반투명도를 증가시키는 동작을 하도록 정의한다.
wezterm.on('increase-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
local opacity = overrides.window_background_opacity
if opacity == nil then
opacity = default_opacity
end
opacity = opacity + 0.1
if opacity > 1.0 then
opacity = 1.0
end
overrides.window_background_opacity = opacity
window:set_config_overrides(overrides)
end)
-- "increase-opacity" 이벤트를 수신했을때, 반투명도를 증가시키는 동작을 하도록 정의한다.
wezterm.on('decrease-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
local opacity = overrides.window_background_opacity
if opacity == nil then
opacity = default_opacity
end
opacity = opacity - 0.1
if opacity < 0.3 then
opacity = 0.3
end
overrides.window_background_opacity = opacity
window:set_config_overrides(overrides)
end)
return {
keys = keymaps
}
대부분 터미널 에뮬레이터에서 탭 이름을 표시할때, 현재 탭에서 돌고 있는 프로세스의 이름을 명시할때가 많다. 그런데, 탭에 명시되어 있는 타이틀만 가지고는 각각의 탭이 어떤 역할을 하는 것인지 파악하기 어렵다. 어느 쪽이 서버를 띄우고 있는건지, 어느 쪽이 에디터 편집 화면인지, 어느 쪽이 LLM Agent를 돌리고 있는지 난해하다.
하지만, 아래처럼 wezterm.action.PromptInputLine API를 사용해서 프롬프트 입력을 받은 내용을 기반으로, 현재 활성화된 탭의 이름을 변경하는 식으로 인지부하를 줄일 수 있다.
local wezterm = require('wezterm')
local keymaps = {}
table.insert(
keymaps,
{
key = '`',
mods = 'CTRL',
action = wezterm.action.PromptInputLine {
description = "Enter new name for tab",
action = wezterm.action_callback(function(window, _, line)
if line then
window:active_tab():set_title(line)
end
end)
}
}
)
return {
keys = keymaps
}
Aider나 Claude Code 같은 LLM 에이전트가 작업을 수행 후 아예 작업이 끝났거나, 혹은 작업에 대한 승인을 요구할 때가 간혹 있다. LLM 에이전트가 작업을 수행하는걸 가만히 보고만 있을 순 없을 것이다.
Claude Code/Aider는 다행히도 응답을 하고 나서 추가적인 명령을 실행할 수 있는 옵션[2]을 제공해주는데, 거기에 간단하게 echo -ne '\007' 명령어를 넘겨줄 수 있다. 이 명령어는 엄청 어렵지는 않다. 터미널 앱에 내장된 시스템 벨 소리를 재생하는 명령어다.
작업 환경이 어디냐에 따라 다를 순 있겠지만, 작업 완료 여부를 음성으로 받기에는 물리적인 제약이 있을 수 있다. 아예 알림 센터를 이용한다고 치자. 업무 시간대에 방해금지 모드를 설정했다면 알림이 울리게 설정이 했더라도 시스템 제약상 묻힐 가능성도 있다.[3]
visual_bell 옵션을 활용하면, 터미널에 내장된 시스템 벨 소리를 울리는 대신 화면이 반짝이게 해서 다른 에이전트가 응답을 완료했다고 명시적으로 알림을 받을 수 있다. LLM 에이전트가 하는 일을 일일이 모니터링하지 않더라도, 다른 작업을 수행하는 중에 화면이 반짝이면 그때 확인하기만 하면 그만이다.
return {
colors = {
visual_bell = '#003355',
},
visual_bell = {
fade_in_duration_ms = 75,
fade_out_duration_ms = 75,
target = 'BackgroundColor', -- 또는 'CursorColor'
}
}
@fedify@hollo.social
🎉 Big thanks to @2chanhaeng for his first contribution to #Fedify! He implemented the new fedify webfinger command in PR #278, which allows isolated #WebFinger lookups for testing configurations. This addresses the need for developers to test WebFinger functionality without performing comprehensive object retrieval.
The contribution includes:
fedify webfinger <handle> command that accepts @user@domain format handles or URIsThis was originally filed as issue #260 and marked as a good first issue—perfect for newcomers to learn the codebase structure while contributing meaningful functionality. The PR has been merged and will be included in the upcoming Fedify 1.8.0 release.
We appreciate all first-time contributors who help make Fedify better for the entire #fediverse community. Welcome aboard, ChanHaeng!
@fedify@hollo.social
🎉 Big thanks to @2chanhaeng for his first contribution to #Fedify! He implemented the new fedify webfinger command in PR #278, which allows isolated #WebFinger lookups for testing configurations. This addresses the need for developers to test WebFinger functionality without performing comprehensive object retrieval.
The contribution includes:
fedify webfinger <handle> command that accepts @user@domain format handles or URIsThis was originally filed as issue #260 and marked as a good first issue—perfect for newcomers to learn the codebase structure while contributing meaningful functionality. The PR has been merged and will be included in the upcoming Fedify 1.8.0 release.
We appreciate all first-time contributors who help make Fedify better for the entire #fediverse community. Welcome aboard, ChanHaeng!
@fedify@hollo.social
🎉 Big thanks to @2chanhaeng for his first contribution to #Fedify! He implemented the new fedify webfinger command in PR #278, which allows isolated #WebFinger lookups for testing configurations. This addresses the need for developers to test WebFinger functionality without performing comprehensive object retrieval.
The contribution includes:
fedify webfinger <handle> command that accepts @user@domain format handles or URIsThis was originally filed as issue #260 and marked as a good first issue—perfect for newcomers to learn the codebase structure while contributing meaningful functionality. The PR has been merged and will be included in the upcoming Fedify 1.8.0 release.
We appreciate all first-time contributors who help make Fedify better for the entire #fediverse community. Welcome aboard, ChanHaeng!
@fedify@hollo.social
🎉 Big thanks to @2chanhaeng for his first contribution to #Fedify! He implemented the new fedify webfinger command in PR #278, which allows isolated #WebFinger lookups for testing configurations. This addresses the need for developers to test WebFinger functionality without performing comprehensive object retrieval.
The contribution includes:
fedify webfinger <handle> command that accepts @user@domain format handles or URIsThis was originally filed as issue #260 and marked as a good first issue—perfect for newcomers to learn the codebase structure while contributing meaningful functionality. The PR has been merged and will be included in the upcoming Fedify 1.8.0 release.
We appreciate all first-time contributors who help make Fedify better for the entire #fediverse community. Welcome aboard, ChanHaeng!
@fedify@hollo.social
🎉 Big thanks to @2chanhaeng for his first contribution to #Fedify! He implemented the new fedify webfinger command in PR #278, which allows isolated #WebFinger lookups for testing configurations. This addresses the need for developers to test WebFinger functionality without performing comprehensive object retrieval.
The contribution includes:
fedify webfinger <handle> command that accepts @user@domain format handles or URIsThis was originally filed as issue #260 and marked as a good first issue—perfect for newcomers to learn the codebase structure while contributing meaningful functionality. The PR has been merged and will be included in the upcoming Fedify 1.8.0 release.
We appreciate all first-time contributors who help make Fedify better for the entire #fediverse community. Welcome aboard, ChanHaeng!
@fedify@hollo.social
🎉 Big thanks to @2chanhaeng for his first contribution to #Fedify! He implemented the new fedify webfinger command in PR #278, which allows isolated #WebFinger lookups for testing configurations. This addresses the need for developers to test WebFinger functionality without performing comprehensive object retrieval.
The contribution includes:
fedify webfinger <handle> command that accepts @user@domain format handles or URIsThis was originally filed as issue #260 and marked as a good first issue—perfect for newcomers to learn the codebase structure while contributing meaningful functionality. The PR has been merged and will be included in the upcoming Fedify 1.8.0 release.
We appreciate all first-time contributors who help make Fedify better for the entire #fediverse community. Welcome aboard, ChanHaeng!
@fedify@hollo.social
🎉 Big thanks to @2chanhaeng for his first contribution to #Fedify! He implemented the new fedify webfinger command in PR #278, which allows isolated #WebFinger lookups for testing configurations. This addresses the need for developers to test WebFinger functionality without performing comprehensive object retrieval.
The contribution includes:
fedify webfinger <handle> command that accepts @user@domain format handles or URIsThis was originally filed as issue #260 and marked as a good first issue—perfect for newcomers to learn the codebase structure while contributing meaningful functionality. The PR has been merged and will be included in the upcoming Fedify 1.8.0 release.
We appreciate all first-time contributors who help make Fedify better for the entire #fediverse community. Welcome aboard, ChanHaeng!
@fedify@hollo.social
🎉 Big thanks to @2chanhaeng for his first contribution to #Fedify! He implemented the new fedify webfinger command in PR #278, which allows isolated #WebFinger lookups for testing configurations. This addresses the need for developers to test WebFinger functionality without performing comprehensive object retrieval.
The contribution includes:
fedify webfinger <handle> command that accepts @user@domain format handles or URIsThis was originally filed as issue #260 and marked as a good first issue—perfect for newcomers to learn the codebase structure while contributing meaningful functionality. The PR has been merged and will be included in the upcoming Fedify 1.8.0 release.
We appreciate all first-time contributors who help make Fedify better for the entire #fediverse community. Welcome aboard, ChanHaeng!
@dweb@social.coop
⚡ Use the Internet Archive like a Hacker-Librarian! 🔮
Join a hands-on workshop where we’ll demystify the CLI and turn it into your super power for archiving, accessing, and uploading content to the @internetarchive.
Hosted by the @ZFAVClub, with the participation of @tommi, we’ll learn and share our experience using the awesome ia #CLI tool!
🗓️ Jul 3, 16:00 UTC (9 PDT, 18 CEST)
PARTICIPATION IS FREE
ℹ️ Info + registration: https://lu.ma/zv3blohp
@readbeanicecream@mastodon.social
Mastodon on Toot TUI
There is nothing like a TUI (text user interface) to really help me focus. So when I stumbled on Toot TUI, I had to give it a try. Now, it is probably one of my favorite terminal applications.
https://readbeanicecream.surge.sh/2025/06/28/mastodon-on-toot-tui/
#indieweb #fediverse #mastodon #cli #tui #linux #socialmedia #technology
@readbeanicecream@mastodon.social
Mastodon on Toot TUI
There is nothing like a TUI (text user interface) to really help me focus. So when I stumbled on Toot TUI, I had to give it a try. Now, it is probably one of my favorite terminal applications.
https://readbeanicecream.surge.sh/2025/06/28/mastodon-on-toot-tui/
#indieweb #fediverse #mastodon #cli #tui #linux #socialmedia #technology
@paco@infosec.exchange
I am slowly oxidizing my unix CLI. A lot of people have made rust based versions of common unix utilities and some of them are REALLY good.
Like fd-find for doing essentially find . -name blah. And rg (ripgrep) which does grep -R but it's aware of git, files like pyc or .bak files, and it excludes them by default.
Now I have sd which is hopefully replacing the last thing I used perl for. I write perl -pi -e s/x/y/g a lot. Just doing a quick string replace inside a file. So sd can start doing that.
I'm also trying to get used to zellij instead of tmux and starship for modern prompt decorations like the kids do.
These kids, my friends, are welcome on my lawn.
@jesuismonsieurb@framapiaf.org
@jesuismonsieurb@framapiaf.org
@JdeBP@tty0.social · Reply to Chris Siebenmann's post
You and Ted Unangst. (-:
* https://news.ycombinator.com/item?id=44307003
Unless there are two *different* pieces about text editors today that conflate command-line and textual user interface.
@nucliweb@webperf.social
Bold Brew (bbrew) - A Homebrew TUI Manager
@nucliweb@webperf.social
Bold Brew (bbrew) - A Homebrew TUI Manager
@grobi@defcon.social
Please Please stop the madness! Stop using Java-script for Unix/Linux tutorials !!
As an intensive Unix and Linux user, I love to use a command-line browser. As a rule, these are links, elinks or lynx for me.
So far, they have guided me to my goal at lightning speed, are resource-saving, require little bandwidth, do not distract with unnecessary bells and whistles and, above all, they work even if the X-system fails and I have to boot without a desktop !
For me, commandline or text-based browsers are part of the Linux fire brigade and are the salvation of many users in need. But it doesn't help at all if manuals, help pages and other tutorials use Java-script!
In the example below, you can see a search query in the links browser with the parameters: "Linux close all windows commandline"
Of the 10 websites shown in the search results, 7 (!) could not be displayed at all because of Javascript, 2 did not really correspond to the parameters and only one (the github page) had a corresponding readable answer.
Does that make sense?
Absolutely not!!
Therefore, an anxious request:
Dear Tutorial Content Creators, Dear OS Developers please stop using Javascript or at least provide a plain text or html option, PLEASE PLEASE PLEASE PLEASE PLEASE
#unix #linux #bsd #gnu #foss #floss #cli #tutorials #browser

@graves501@fosstodon.org
@hugovk@mastodon.social · Reply to Hugo van Kemenade's post
Just released! 🚀
Enabled colour help for Python 3.14:
🎨 em-keyboard 5.2.0
🎨 linkotron 0.5.0
🎨 norwegianblue 0.22.0
🎨 pepotron 1.5.0
🎨 pypistats 1.10.0
Also added Python 3.15 to pepotron: `pep 3.15` opens PEP 790.
#release #python314 #colour #CLI #EmKeyboard #linkotron #norwegianblue #pepotron #pypistats #help
@lavxnews@ioc.exchange
Introducing kdlfmt: The Essential CLI Tool for KDL Document Formatting
The new kdlfmt CLI tool simplifies the formatting and validation of KDL (Kotlin Data Language) documents, making it an indispensable utility for developers working with this emerging data format. Buil...
https://news.lavx.hu/article/introducing-kdlfmt-the-essential-cli-tool-for-kdl-document-formatting
@toxi@mastodon.thi.ng
#ReleaseWednesday Just pushed a new version of https://thi.ng/block-fs, now with additional multi-command CLI tooling to convert & bundle a local file system tree into a single block-based binary blob (e.g. for bundling assets, or distributing a virtual filesystem as part of a web app, or for snapshot testing, or as bridge for WASM interop etc.)
Also new, the main API now includes a `.readAsObjectURL()` method to wrap files as URLs to binary blobs with associated MIME types, thereby making it trivial to use the virtual filesystem for sourcing stored images and other assets for direct use in the browser...
(Ps. For more context see other recent announcement: https://mastodon.thi.ng/@toxi/114264980961483146)
#ThingUmbrella #BlockStorage #FileSystem #BlockFS #VirtualFS #CLI #TypeScript #JavaScript #OpenSource
@readbeanicecream@mastodon.social
Zettelkasten on the CLI
Let's take a look at my Zettelkasten notetaking workflow on the Linux Command Line. Trust me, it's simple.
https://readbeanicecream.surge.sh/2025/03/24/zettelkasten-on-the-cli/
#productivity #notetaking #linux #cli #commandline indieweb #blogging #smallweb #personalweb #tech #technology #zettelkasten
@epilys@chaos.social
Stupid-but-works tip on how to add inline documentation comments for multi-line shell commands in scripts: Combine command substitution with grave accents "`" and the do-nothing built-in command ":":
```shell
% ls \
> -h `: this is a comment` \
> -a `: this is another comment` \
> -t `: more commentssss`
```
@epilys@chaos.social
Stupid-but-works tip on how to add inline documentation comments for multi-line shell commands in scripts: Combine command substitution with grave accents "`" and the do-nothing built-in command ":":
```shell
% ls \
> -h `: this is a comment` \
> -a `: this is another comment` \
> -t `: more commentssss`
```
@readbeanicecream@mastodon.social
Zettelkasten on the CLI
Let's take a look at my Zettelkasten notetaking workflow on the Linux Command Line. Trust me, it's simple.
https://readbeanicecream.surge.sh/2025/03/24/zettelkasten-on-the-cli/
#productivity #notetaking #linux #cli #commandline indieweb #blogging #smallweb #personalweb #tech #technology #zettelkasten
@hugovk@mastodon.social · Reply to Hugo van Kemenade's post
Just released: pypistats 1.9.0 🚀
pypistats is CLI to show download stats from PyPI
https://pypi.org/project/pypistats/1.9.0/
* Replace deprecated classifier with licence expression (PEP 639)
* Remove GitHub attestation, uses PyPI attestations instead (PEP 740)
* Add input validation for total and fix --monthly with no mirror
* Update docs for recent command
@FediTips@social.growyourown.services
Here's a very brief tip for the more techy people on here:
You can use Mastodon (and compatible servers) through command lines and text-based interfaces with the free open source client "toot":
There are lots more details on the developer's website.
@FediTips@social.growyourown.services
Here's a very brief tip for the more techy people on here:
You can use Mastodon (and compatible servers) through command lines and text-based interfaces with the free open source client "toot":
There are lots more details on the developer's website.
@scy@chaos.social
`lowdown -tterm` produces pretty nice #Markdown rendering in the #terminal.
@maxlath@mastodon.social · Reply to Sebastian Lasse's post

@freespiritlinux69@fedi.at
Schönen guten Morgen,
Ich habe mich entschieden, ein kleines Tutorial über CLI-Befehle unter Linux zu erstellen.
CLI steht für Command Line Interface, was auf Deutsch als Befehlszeilenschnittstelle bezeichnet wird. Es handelt sich um eine textbasierte Benutzeroberfläche, die es Benutzern ermöglicht, mit einem Computer oder einem Betriebssystem zu interagieren, indem sie Befehle in Form von Text eingeben.
In Linux kann das sogenannte Terminal zur Eingabe von CLI-Befehlen verwendet werden.
Bitte teilt das mit eurer #followerpower, damit mehr Menschen darauf aufmerksam werden. Dieses Tutorial richtet sich an Anfänger, die das Terminal unter Linux nicht als furchterregendes Monster betrachten, sondern effizient damit arbeiten möchten.
DANKESCHÖN
Der Link führt direkt zum Thread mit dem Tutorial und kann bei Bedarf gespeichert werden.
@tuist@fosstodon.org
Soon our Noora single-choice prompt component will support filtering thanks to @finnvoorhees's brilliant work in this PR:
https://github.com/tuist/Noora/pull/195
@tuist@fosstodon.org
Soon our Noora single-choice prompt component will support filtering thanks to @finnvoorhees's brilliant work in this PR:
https://github.com/tuist/Noora/pull/195
@artemissian@fosstodon.org
Alternative #CLI tools to check out and try:
bat https://github.com/sharkdp/bat
bottom https://github.com/ClementTsang/bottom
broot https://github.com/Canop/broot
btop https://github.com/aristocratos/btop
cheat https://github.com/cheat/cheat
choose https://github.com/theryangeary/choose
curlie https://github.com/rs/curlie
delta https://github.com/dandavison/delta
doggo https://github.com/mr-karan/doggo
dust https://github.com/bootandy/dust
duf https://github.com/muesli/duf
dysk https://github.com/Canop/dysk
eza https://github.com/eza-community/eza
fd https://github.com/sharkdp/fd
fzf https://github.com/junegunn/fzf
@artemissian@fosstodon.org
Alternative #CLI tools to check out and try:
bat https://github.com/sharkdp/bat
bottom https://github.com/ClementTsang/bottom
broot https://github.com/Canop/broot
btop https://github.com/aristocratos/btop
cheat https://github.com/cheat/cheat
choose https://github.com/theryangeary/choose
curlie https://github.com/rs/curlie
delta https://github.com/dandavison/delta
doggo https://github.com/mr-karan/doggo
dust https://github.com/bootandy/dust
duf https://github.com/muesli/duf
dysk https://github.com/Canop/dysk
eza https://github.com/eza-community/eza
fd https://github.com/sharkdp/fd
fzf https://github.com/junegunn/fzf
@hyalinesystems@mastodon.social
📼 Command line video magic for ARTISTS
A cookbook by @madskjeldgaard for audio and video processing on the command line – with examples!
Includes how to generate a spectrum video from an audio file. How to combine an audio file and an image into a video. Among other things.
And it includes full #bash scripts and examples for for-loops, so you could do this on tons of audio files, if you so fancied 🤠
@ploum@mamot.fr
If you are a Unix nerd and wish you spend less time using your mouse while watching flashy colors, I recommend that you give Offpunk a try:
I’m trying to make it easier to get started with offpunk. Feedbacks and discussions are welcome on the mailing-list :
https://lists.sr.ht/~lioploum/offpunk-users
or on the fediverse, using the #offpunk hashtag. Or on your blog. That would be awesome to read blog posts about people using offpunk
@orhun@fosstodon.org
I found the ultimate CLI tool for processing CSV files! 🔥
🪄✨ **xan**: The CSV magician.
💯 Supports expressions, parallelism, advanced filtering, sorting, and visualizations.
🦀 Written in Rust & uses @ratatui_rs
⭐ GitHub: https://github.com/medialab/xan
@ploum@mamot.fr
If you are a Unix nerd and wish you spend less time using your mouse while watching flashy colors, I recommend that you give Offpunk a try:
I’m trying to make it easier to get started with offpunk. Feedbacks and discussions are welcome on the mailing-list :
https://lists.sr.ht/~lioploum/offpunk-users
or on the fediverse, using the #offpunk hashtag. Or on your blog. That would be awesome to read blog posts about people using offpunk
@orhun@fosstodon.org
I found the ultimate CLI tool for processing CSV files! 🔥
🪄✨ **xan**: The CSV magician.
💯 Supports expressions, parallelism, advanced filtering, sorting, and visualizations.
🦀 Written in Rust & uses @ratatui_rs
⭐ GitHub: https://github.com/medialab/xan
@nev@bananachips.club · Reply to Julia's Reruns Bot's post
@b0rk_reruns ok so i have a kind of cursed question. often i'm doing something like `for file in $(ls *.txt); do echo ${file%.txt}; done`. why won't bash let me do ${$(ls *.txt)%.txt} and is there a better way to do it
(cc @b0rk)
@hongminhee@hollo.social
@hongminhee@hollo.social
@hongminhee@hollo.social
@blinry@chaos.social
I'm looking for a command line tool that allows watching a video file together on two computers, with synchronized play/pause, like these "watch party" sites, but inside a local network.
In the simplest case, it could be a Bash command streaming/decoding a local file at the same time, and another person could receive that stream…? Has anyone seen something like that? #cli #linux
@blinry@chaos.social
I'm looking for a command line tool that allows watching a video file together on two computers, with synchronized play/pause, like these "watch party" sites, but inside a local network.
In the simplest case, it could be a Bash command streaming/decoding a local file at the same time, and another person could receive that stream…? Has anyone seen something like that? #cli #linux
@ploum@mamot.fr
Released Offpunk 2.5 which add custom "aliases" and improve compatibility with #openbsd and #python version < 3.11
What is Offpunk?
https://offpunk.net/whatisoffpunk.html
You are welcome to discuss and ask questions on the offpunk-users list:
https://lists.sr.ht/~lioploum/offpunk-users
If you are familiar with python development, join the offpunk-devel list to help intregrate offpunk and unmerdify, a new library developed by @vjousse :
https://lists.sr.ht/~lioploum/offpunk-devel/%3C4841675b-b03e-4c80-9677-ddc18d840656@jousse.org%3E
@ploum@mamot.fr
Released Offpunk 2.5 which add custom "aliases" and improve compatibility with #openbsd and #python version < 3.11
What is Offpunk?
https://offpunk.net/whatisoffpunk.html
You are welcome to discuss and ask questions on the offpunk-users list:
https://lists.sr.ht/~lioploum/offpunk-users
If you are familiar with python development, join the offpunk-devel list to help intregrate offpunk and unmerdify, a new library developed by @vjousse :
https://lists.sr.ht/~lioploum/offpunk-devel/%3C4841675b-b03e-4c80-9677-ddc18d840656@jousse.org%3E
@WeirdWriter@caneandable.social
So, I am giving #RClone a try. It’s a command line utility that will allow you to copy things from one cloud storage to the other with ease, sync one way or buy directionally, and Mount cloud storage as virtual drives on your machine so you can mount things like Google Drive, iCloud Drive, and even OneDrive without using any of their bloated and inaccessible software. Of course, the first thing I tried to do with it, it’s not capable of Yet. I tried to copy my writing from an off-line hard drive to three different cloud services with one command. That’s not possible as of yet, but I would still highly recommend this tool even if I’m sure I’m not utilizing it to its full glory as of yet. #CLI #DropBox, #NextCloud, #OneDrive
@nickbearded@mastodon.social
The website is live!
#linux #bashcore #cli #nogui #debian #security #pentesting #education #bash
Qiita - 人気の記事@qiita@rss-mstdn.studiofreesia.com
@levibeach@merveilles.town · Reply to Levi Beach's post
Thinking through some settings UI this morning.
@sramsay@hcommons.social
I'm pleased to present a new blog post -- "Beautiful Documents with Groff (Part II)" https://stephenramsay.net/posts/groff-mom2.html -- only a year-and-a-half after "Beautiful Documents with Groff (Part I)" https://stephenramsay.net/posts/groff-mom.html
Of interest, perhaps, to users of #pandoc and/or #Linux, #cli cultists, and digital document nerds. Discusses #groff, #latex, #typst, and even #pollen (though not the kind that makes you sneeze).
@levibeach@merveilles.town · Reply to Levi Beach's post
So I guess it's happening and I'm really excited to explore all the possibilities. Using the Node binding for Rust's Web Audio API to create sound, which means I can do stuff like impulse response to model spaces!
@hugovk@mastodon.social · Reply to Hugo van Kemenade's post
Just released! stravavis 0.5.0 🚀
Create artistic visualisations with your exercise data.
https://pypi.org/project/stravavis/0.5.0/
🚴 Drop support for EOL Python 3.8
🏃 Skip segments in GPX tracks with empty trkseg
🛶 Fix pandas warnings
@hugovk@mastodon.social · Reply to Hugo van Kemenade's post
Just released: blurb 1.3.0 🚀
blurb is the CLI we use for managing CPython's news/changelog entries.
🗞️ Add support for Python 3.13
🗞️ Drop support for Python 3.8
🗞️ Generate digital attestations for PyPI (PEP 740)
🗞️ Allow running blurb test from blurb-* directories by
🗞️ Add version subcommand
🗞️ Generate __version__ at build to avoid slow importlib.metadata
https://pypi.org/project/blurb/1.3.0/
#Python #CPython #blurb #release #CLI #changelog #news #PEP740 #Python313 #Python38
@hugovk@mastodon.social · Reply to Hugo van Kemenade's post
Just released: norwegianblue 0.19.0 🚀
🦜 Drop support for Python 3.8
🦜 Generate digital attestations for PyPI (PEP 740)
🦜 Test with tox-uv
🦜 Lint with pre-commit-uv
https://pypi.org/project/norwegianblue/0.19.0/
norwegianblue is a CLI to show EOLs from https://endoflife.date
@hugovk@mastodon.social · Reply to Hugo van Kemenade's post
Just released: pepotron 1.3.0 🚀
🔩 Generate digital attestations for PyPI (PEP 740)
🔩 Drop support for Python 3.8
🔩 Generate __version__ at build to avoid slow importlib.metadata
🔩 Test on CI with uv
https://pypi.org/project/pepotron/1.3.0/
Pepotron is a CLI for opening PEPs in your browser. For example, try:
$ pep 8
$ pep 3.14
$ pep dead batteries
$ pep calendar
@hugovk@mastodon.social · Reply to Hugo van Kemenade's post
Just released: pypistats 1.7.0 🚀
📈 Generate digital attestations for PyPI (PEP 740)
📉 Drop support for EOL Python 3.8
📈 Generate __version__ at build to avoid slow importlib.metadata
@mariusor@metalhead.club
@summeremacs@fashionsocial.host
I just posted a new file about how I got into using #Emacs, #Linux, the #CLI, and other things.
Here it is: https://summeremacs.github.io/posts/how-i-came-to-use-emacs-and-other-things/
And no @daviwil, I'm still not starting a blog to post this stuff. 😀
Edit: I was wrong. @daviwil was right. I am leaving my post up here as a victory for him. 🤣
@jelloeater@mastodon.social
Got bored, wrote a #CLI timestamp app in #golang
https://github.com/Jelloeater/stampy
@matclab@mamot.fr
Je relance mon blog, en modifiant le système de commentaire pour qu'il utilise mastodon.
Je vais mettre quelques liens ici et commencer par un retour d'expérience sur l'utilisation de `ledger-cli` pour faire mes comptes (que j'utilise toujours).
https://ontoblogie.clabaut.net/posts/201903/gerer-ses-comptes-en-ligne-de-commande.html
@whalecoiner@indieweb.social
Does anyone have a recommendation for a CLI boilerplate text file creator? I need something to help with using my personal website better. I’m thinking of something where I can type “<app> new post” or “<app> new note” and a markdown file of appropriate frontmatter stubs is created, in a predefined directory. It’d have to have some kind of template system available. Know of anything?
@OS1337@infosec.space
For everyone wanting to test out OS/1337 there's good news:
You can just clone the #git repo or pull it as #zip:
https://github.com/OS-1337/OS1337
and then just run ./scripts/build.sh
and within a few mins it'll spit out a bootable #1440kB image in /build/0.CORE/ to put on a 3,5" FDD or run in a VM [may it be #QEMU or #VirtualBox]...
Thanks to @SweetAIBelle for the generous contributions!
#OS1337 #Linux #Development #Embedded #EmbeddedLinux #CLI #TUI #minimalist #OS #FLOSS #OSS #FOSS
@servio@libretics.org

#LibreTICs: un lugar de encuentro, debate, investigación, desarrollo y difusión acerca de los usos sociales de la tecnología.
Contacto:
Radio https://libretics.org/radio
#Podcast: podcast.libretics.org/
#XMPP Grupo xmpp:hacklab-libretics@salas.gnlug…
Grupo #DeltaChat: i.delta.chat/#FF36E74BCB6E7C00
#Onion Blog: http://3puc73jz3pbflplwe7y5hkopdoq…
Me gusta mucho el concepto de la internet pequeña: 1 persona = 1 servidor = 1 página web. 🧑💻🧰🐃🐧🇪🇨
#softwarelibre #gnu #linux #fediverso #lineadecomandos #terminal #cli #sabadodeterminal #viernesdeescritorio #radio #privacidad #comunidad
@scy@chaos.social
`lowdown -tterm` produces pretty nice #Markdown rendering in the #terminal.
@nojhan@mamot.fr
Il parait que j'aurais dû faire une #introduction depuis 6 ans, alors voilà. Ici, je pouet :
– science (recherche appliqué en algorithmique de l'#IA, en ce moment assez saoulé par son dévoiement corporate),
– design & illustration (souvent vectorielle sous #inkscape),
– code libre (auteur de #CLI : #liquidprompt, #colout, …),
– politique (anar gauchiste, centriste repenti, radicalisé par le macronisme),
– sondages bizarres (neuroatypique tentant de comprendre comment ça marche dans votre tête).
@elijahmanor@hachyderm.io
@sgued@pouet.chapril.org
🇫🇷 Étudiant, passionné de logiciels libres. J'ai créé peertube-viewer, un petit outil en ligne de commande pour naviguer les vidéos #peertube, dans le même esprit que youtube-viewer
🇬🇧 Student, passionate by #FLOSS. I created peertube-viewer, a small #CLI tool to browse peertube instances, quite similar to youtube-viewer.