Compare commits

..

3 Commits

Author SHA1 Message Date
6081122e88 publish based on tag releases instead of main releases 2024-02-20 23:22:17 -07:00
db18183c94 add typescript dependency 2024-02-20 23:12:18 -07:00
fec8c5e560 basic runner format; write a MAIN function
introduce --verbosity flag rather than mixed logging settings; correct color misnaming to ANSI convention; added sanity-check; simplified hello-world; created FZF_USER_INPUT to replace the confusing FZF_HEAD and FZF_TAIL

swap INFO for DEBUG

v3-to-v4 upgrade docs

bring some much-needed tender love and care to the scwrypts runner

improved i/o handling on the run executable means this is no longer relevant

FINALLY fix the weird cases for zsh/read builtin (particularly around reading one character from tty/pipe/file); also gave a --force-user-input flag in case you want to require user input on a yn prompt

update ZLE plugin so it no more make errors

FZF_(HEAD|TAIL) refactor to FZF_USER_INPUT

plugins/kubectl migration from v3 to v4

plugins/ci migration from v3 to v4

refactor py/lib into python-scwrypts subproject

verbosity is stupid lets call it log-level

fix bug with virtualenv loading

mergedeep to slow so I made my options dict shallow

hokay first iteration of python-dudes is ready

circleci configuration for python builds

npm package for scwrypts

3.9.1

initial build/test steps for nodejs

go

go

ok

ok

fix output

ok

ok

finalize publish steps
2024-02-20 23:08:55 -07:00
7 changed files with 16 additions and 56 deletions

View File

@ -30,7 +30,6 @@ jobs:
&& pip install . .[test] \ && pip install . .[test] \
&& pytest \ && pytest \
; ;
- run: pip install build && python -m build
python-publish: python-publish:
executor: python executor: python
@ -38,7 +37,7 @@ jobs:
steps: steps:
- checkout: - checkout:
path: ~/scwrypts path: ~/scwrypts
- run: pip install build && python -m build - python/dist
- run: pip install twine && twine upload dist/* - run: pip install twine && twine upload dist/*
nodejs-test: nodejs-test:
@ -103,56 +102,32 @@ jobs:
: \ : \
&& [ $CIRCLE_TAG ] \ && [ $CIRCLE_TAG ] \
&& pnpm build \ && pnpm build \
&& pnpm version $CIRCLE_TAG \ && pnpm version $(git describe --tags) \
&& pnpm set //registry.npmjs.org/:_authToken=$NPM_TOKEN \ && pnpm set //registry.npmjs.org/:_authToken=$NPM_TOKEN \
&& pnpm publish --no-git-checks \ && pnpm publish --no-git-checks \
; ;
workflows: workflows:
python-dev:
jobs:
- python-test:
filters:
branches:
ignore: /^main$/
python: python:
jobs: jobs:
- python-test: - python-test
filters:
tags:
only: /^v\d+\.\d+\.\d+.*$/
branches:
ignore: /^.*$/
- python-publish: - python-publish:
requires: [python-test] requires: [python-test]
context: [pypi-yage] context: [pypi-yage]
filters: filters:
tags: tags:
only: /^v\d+\.\d+\.\d+.*$/ only: /^v.*$/
branches: branches:
ignore: /^.*$/ ignore: /^.*$/
nodejs-dev:
jobs:
- nodejs-test:
filters:
branches:
ignore: /^main$/
nodejs: nodejs:
jobs: jobs:
- nodejs-test: - nodejs-test
filters:
tags:
only: /^v\d+\.\d+\.\d+.*$/
branches:
ignore: /^.*$/
- nodejs-publish: - nodejs-publish:
requires: [nodejs-test] requires: [nodejs-test]
context: [npm-wrynegade] context: [npm-wrynegade]
filters: filters:
tags: tags:
only: /^v\d+\.\d+\.\d+.*$/ only: /^v.*$/
branches: branches:
ignore: /^.*$/ ignore: /^.*$/

View File

@ -29,7 +29,6 @@ runs:
repository: wrynegade/scwrypts repository: wrynegade/scwrypts
path: ./wrynegade/scwrypts path: ./wrynegade/scwrypts
ref: ${{ inputs.version }} ref: ${{ inputs.version }}
fetch-tags: true
- name: check dependencies - name: check dependencies
shell: bash shell: bash
@ -52,7 +51,7 @@ runs:
} > $HOME/.scwrypts.apt-get.log 2>&1 } > $HOME/.scwrypts.apt-get.log 2>&1
echo "updating virtual dependencies" echo "updating virtual dependencies"
$GITHUB_WORKSPACE/wrynegade/scwrypts/scwrypts \ $GITHUB_WORKSPACE/wrynegade/scwrypts/scwrypts -n \
--name scwrypts/virtualenv/update-all \ --name scwrypts/virtualenv/update-all \
--group scwrypts \ --group scwrypts \
--type zsh \ --type zsh \

3
py/lib/.gitignore vendored
View File

@ -1,4 +1 @@
dist/ dist/
__pycache__/
*.py[cod]
*.so

View File

@ -55,5 +55,6 @@ source = 'versioningit'
[tool.hatch.build.targets.wheel] [tool.hatch.build.targets.wheel]
packages = ['./'] packages = ['./']
[tool.versioningit.vcs] [tool.versioningit]
match = ['v[0-9]*.[0-9]*.[0-9]*'] match = ['v*']

View File

@ -41,7 +41,7 @@ def scwrypts(*args, patterns=None, name=None, group=None, _type=None, log_level=
depth = int(depth) + 1 depth = int(depth) + 1
return run( return run(
f'SUBSCWRYPT={depth} {executable} {" ".join(pre_args)} -- {" ".join(args)}', f'SUBSCWRYPT={depth} {executable} {pre_args} -- {" ".join(args)}',
shell=True, shell=True,
executable='/bin/zsh', executable='/bin/zsh',
check=False, check=False,

View File

@ -15,31 +15,26 @@ ERROR() { # command encountered an error
SUCCESS() { # command completed successfully SUCCESS() { # command completed successfully
[[ $SCWRYPTS_LOG_LEVEL -ge 1 ]] \ [[ $SCWRYPTS_LOG_LEVEL -ge 1 ]] \
&& PREFIX="SUCCESS ✔" COLOR=$__GREEN PRINT "$@" && PREFIX="SUCCESS ✔" COLOR=$__GREEN PRINT "$@"
return 0
} }
REMINDER() { # include sysadmin reminder or other important notice to users REMINDER() { # include sysadmin reminder or other important notice to users
[[ $SCWRYPTS_LOG_LEVEL -ge 1 ]] \ [[ $SCWRYPTS_LOG_LEVEL -ge 1 ]] \
&& PREFIX="REMINDER " COLOR=$__BRIGHT_MAGENTA PRINT "$@" && PREFIX="REMINDER " COLOR=$__BRIGHT_MAGENTA PRINT "$@"
return 0
} }
STATUS() { # general status updates (prefer this to generic 'echo') STATUS() { # general status updates (prefer this to generic 'echo')
[[ $SCWRYPTS_LOG_LEVEL -ge 2 ]] \ [[ $SCWRYPTS_LOG_LEVEL -ge 2 ]] \
&& PREFIX="STATUS " COLOR=$__BLUE PRINT "$@" && PREFIX="STATUS " COLOR=$__BLUE PRINT "$@"
return 0
} }
WARNING() { # warning-level messages; not errors WARNING() { # warning-level messages; not errors
[[ $SCWRYPTS_LOG_LEVEL -ge 3 ]] \ [[ $SCWRYPTS_LOG_LEVEL -ge 3 ]] \
&& PREFIX="WARNING " COLOR=$__YELLOW PRINT "$@" && PREFIX="WARNING " COLOR=$__YELLOW PRINT "$@"
return 0
} }
DEBUG() { # helpful during development or (sparingly) to help others' development DEBUG() { # helpful during development or (sparingly) to help others' development
[[ $SCWRYPTS_LOG_LEVEL -ge 4 ]] \ [[ $SCWRYPTS_LOG_LEVEL -ge 4 ]] \
&& PREFIX="DEBUG " COLOR=$__WHITE PRINT "$@" && PREFIX="DEBUG " COLOR=$__WHITE PRINT "$@"
return 0
} }
PROMPT() { # you probably want to use yN or INPUT from below PROMPT() { # you probably want to use yN or INPUT from below
@ -47,7 +42,6 @@ PROMPT() { # you probably want to use yN or INPUT from below
&& PREFIX="PROMPT " COLOR=$__CYAN PRINT "$@" \ && PREFIX="PROMPT " COLOR=$__CYAN PRINT "$@" \
&& PREFIX="USER ⌨" COLOR=$__BRIGHT_CYAN PRINT '' --no-line-end \ && PREFIX="USER ⌨" COLOR=$__BRIGHT_CYAN PRINT '' --no-line-end \
; ;
return 0
} }
FAIL() { SCWRYPTS_LOG_LEVEL=1 ERROR "${@:2}"; exit $1; } FAIL() { SCWRYPTS_LOG_LEVEL=1 ERROR "${@:2}"; exit $1; }
@ -217,21 +211,15 @@ READ_YN() { # yes/no read is suprisingly tricky
local yn local yn
PROMPT "${USERPROMPT[@]}" PROMPT "${USERPROMPT[@]}"
local PERFORM_FAKE_PROMPT=false
case $SKIP_USER_INPUT in case $SKIP_USER_INPUT in
true ) yn=y ;; true ) yn=y ;;
false ) false )
[[ $SCWRYPTS_LOG_LEVEL -lt 1 ]] && { [[ $FORCE_USER_INPUT =~ true ]] && [[ $SCWRYPTS_LOG_LEVEL -lt 1 ]] \
[[ $FORCE_USER_INPUT =~ false ]] && [ ! -t 0 ] \
|| PERFORM_FAKE_PROMPT=true
}
[[ $PERFORM_FAKE_PROMPT =~ true ]] \
&& echo -n "${USERPROMPT[@]} : " >&2 && echo -n "${USERPROMPT[@]} : " >&2
READ ${READ_ARGS[@]} -s -k yn READ ${READ_ARGS[@]} -s -k yn
[[ $PERFORM_FAKE_PROMPT =~ true ]] \ [[ $FORCE_USER_INPUT =~ true ]] && [[ $SCWRYPTS_LOG_LEVEL -lt 1 ]] \
&& echo $yn >&2 && echo $yn >&2
;; ;;
esac esac

6
zx/package-lock.json generated
View File

@ -31,7 +31,6 @@
"prettier": "^3.2.5", "prettier": "^3.2.5",
"ts-jest": "^29.1.2", "ts-jest": "^29.1.2",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "^5.3.3",
"uuid": "^9.0.1" "uuid": "^9.0.1"
} }
}, },
@ -4998,6 +4997,7 @@
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"dev": true, "dev": true,
"peer": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
"tsserver": "bin/tsserver" "tsserver": "bin/tsserver"
@ -8596,7 +8596,6 @@
"prettier": "^3.2.5", "prettier": "^3.2.5",
"ts-jest": "^29.1.2", "ts-jest": "^29.1.2",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "^5.3.3",
"uuid": "^9.0.1" "uuid": "^9.0.1"
} }
}, },
@ -8885,7 +8884,8 @@
"version": "5.3.3", "version": "5.3.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
"dev": true "dev": true,
"peer": true
}, },
"undici-types": { "undici-types": {
"version": "5.26.5", "version": "5.26.5",