=====================================================================
Big day! V4 is finally live. This INCLUDES some BREAKING CHANGES to ZSH
TYPE scwrypts! Please refer to the readme for upgrade details
(more specifically docs/upgrade/v3-to-v4.md)
Upgrade is SUPER EASY, so please take the time to do so.
--- New Features ----------------------------------------------------
- zsh type scwrypts have an upgraded runstring to improve context setup
and simplicity to the scwrypt-writer
- scwrypts now publishes the package (scwrypts) to PyPi; this provides a
simple way to invoke scwrypts from python-based environments as well
as the entire scwrypts python library suite
pip install scwrypts
- scwrypts now publishes the package (scwrypts) to npm; this provides a
simple way to invoke scwrypts from nodesjs environments
npm install scwrypts
--- Bug Fixes -------------------------------------------------------
- scwrypts runner prompts which use the zshbuiltin "read" now
appropriately read input from tty, pipe, files, and user input
- virtualenv refresh now loads and prepares the scwrypts virtual
environments correctly
--- Changes ---------------------------------------------------------
- created the (-v, --log-level) scwrypts arguments as improvements of
and replacements to the --verbose and --no-log flags
- (-n) is now an alias for (--log-level 0)
- (--no-log) is the same as (-n) for compatibility, but will be removed in 4.2
- zsh/lib/utils/io print functions now *interact with log-level* various
log levels will now only display the appropriate console prints for
the specified log level
- zsh/lib/utils/io:INFO has been renamed to DEBUG to align with
log-level output; please use DEBUG for debug messages and REMINDER for
important user messages
- created zsh/lib/utils/io:FZF_USER_INPUT as a *drop-in replacement* for
the confusing FZF_HEAD and FZF_TAIL commands. Update by literally
changing any instances of FZF_HEAD or FZF_TAIL with FZF_USER_INPUT
- FZF_HEAD and FZF_TAIL will be removed in 4.2
- zsh/lib/utils/io:READ (and other zshbuiltin/read-based prompts) now
accept a --force-user-input flag in case important checks should
require an admin's approval. This flag will ensure that piped input
and the `scwrypts -y` flag are ignored for the single prompt.
- zsh/lib/utils/color has been updated to use color names which match
the ANSI color names
- zsh/hello-world has been reduced to a minimal example; this is to
emphasize ease-of-use with v4
- zsh/sanity-check is a scwrypts/run testing helper and detailed
starting reference (helpful since hello-world is now minimal)
- various refactor, updates, and improvements to the scwrypts runner
- migrated all zsh scwrypts and plugins to use v4 runner syntax
- zsh
- plugins/kubectl
- plugins/ci
- refactored py/lib into py/lib/scwrypts (PyPi)
61 lines
3.1 KiB
Markdown
61 lines
3.1 KiB
Markdown
# *Scwrypts* (Wryn + Scripts)
|
|
|
|
Scwrypts is a friendly CLI / API for quickly running *sandboxed scripts* in the terminal.
|
|
|
|
In modern developer / dev-ops workflows, scripts require a complex configurations.
|
|
Without a better solution, the developer is cursed to copy lines-upon-lines of variables into terminals, create random text artifacts, or maybe even commit secure credentials into source.
|
|
Scwrypts leverages ZSH to give hot-key access to run scripts in such environments.
|
|
|
|
## Major Version Upgrade Notice
|
|
|
|
Please refer to [Version 3 to Version 4 Upgrade Path](./docs/upgrade/v3-to-v4.md) when upgrading from scwrypts v3 to scwrypts v4!
|
|
|
|
## Dependencies
|
|
Due to the wide variety of resources used by scripting libraries, the user is expected to manually resolve dependencies.
|
|
Dependencies are lazy-loaded, and more information can be found by command error messages or in the appropriate README.
|
|
|
|
Because Scwrypts relies on Scwrypts (see [Meta Scwrypts](./zsh/scwrypts)), `zsh` must be installed and [`junegunn/fzf`](https://github.com/junegunn/fzf) must be available on your PATH.
|
|
|
|
## Usage
|
|
Install Scwrypts by cloning this repository and sourcing `scwrypts.plugin.zsh` in your `zshrc`.
|
|
You can now run Scwrypts using the ZLE hotkey bound to `SCWRYPTS_SHORTCUT` (default `CTRL + W`).
|
|
|
|
```console
|
|
% cd <path-to-cloned-repo>
|
|
% echo "source $(pwd)/scwrypts.plugin.zsh >> $HOME/.zshrc"
|
|
```
|
|
|
|
Check out [Meta Scwrypts](./zsh/scwrypts) to quickly set up environments and adjust configuration.
|
|
|
|
|
|
### No Install / API Usage
|
|
Alternatively, the `scwrypts` API can be used directly:
|
|
```zsh
|
|
./scwrypts [--env environment-name] (...script-name-patterns...) [-- ...passthrough arguments... ]
|
|
```
|
|
|
|
Given one or more script patterns, Scwrypts will filter the commands by pattern conjunction.
|
|
If only one command is found which matches the pattern(s), it will immediately begin execution.
|
|
If multiple commands match, the user will be prompted to select from the filtered list.
|
|
Of course, if no commands match, Scwrypts will exit with an error.
|
|
|
|
Given no script patterns, Scwrypts becomes an interactive CLI, prompting the user to select a command.
|
|
|
|
After determining which script to run, if no environment has been specified, Scwrypts prompts the user to choose one.
|
|
|
|
|
|
### Using in CI/CD or Automated Workflows
|
|
Set environment variable `CI=true` (and use the no install method) to run in an automated pipeline.
|
|
There are a few notable changes to this runtime:
|
|
- **The Scwrypts sandbox environment will not load.** All variables will be read from context.
|
|
- User yes/no prompts will **always be YES**
|
|
- Other user input will default to an empty string
|
|
- Logs will not be captured
|
|
- Setting the environment variable `SCWRYPTS_GROUP_LOADER__[a-z_]\+` will source the file indicated in the variable (this allows custom groups without needing to modify the `config.zsh` directly)
|
|
- In GitHub actions, `*.scwrypts.zsh` groups are detected automatically from the `$GITHUB_WORKSPACE`; set `SCWRYPTS_GITHUB_NO_AUTOLOAD=true` to disable
|
|
|
|
|
|
## Contributing
|
|
|
|
Before contributing an issue, idea, or pull request, check out the [super-brief contributing guide](./docs/CONTRIBUTING.md)
|