1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-16 13:38:02 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
nick-w-nick
07c677f6b6 Merge 295fe153ad into c8aa6ee506 2024-12-29 02:24:49 -05:00
jbranchaud
c8aa6ee506 Add Break Justfile Into Separate Hidden Steps as a Workflow TIL 2024-12-28 09:20:00 -07:00
nick-w-nick
295fe153ad added mention of ES6 compatibility
Hello, I've added a small blockquote below the description to indicate that this method of accessing an indefinite number of function arguments has been superseded by the use of the spread operator via rest parameters for ES6+ compatibility.
2022-01-06 11:39:04 -05:00
3 changed files with 52 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1550 TILs and counting..._
_1551 TILs and counting..._
---
@@ -1785,6 +1785,7 @@ _1550 TILs and counting..._
- [Add Subtitles To Existing Mux Video Asset](workflow/add-subtitles-to-existing-mux-video-asset.md)
- [Access 1Password Credential From CLI](workflow/access-1password-credential-from-cli.md)
- [Allow Key-Repeating With Cursor](workflow/allow-key-repeating-with-cursor.md)
- [Break Justfile Into Separate Hidden Steps](workflow/break-justfile-into-separate-hidden-steps.md)
- [Change Window Name In iTerm](workflow/change-window-name-in-iterm.md)
- [Configure Email Redirect With Cloudflare](workflow/configure-email-redirect-with-cloudflare.md)
- [Convert An ePub Document To PDF On Mac](workflow/convert-an-epub-document-to-pdf-on-mac.md)

View File

@@ -5,6 +5,8 @@ an array-like object with all of the arguments to the function. Even if not
all of the arguments are referenced in the function signature, they can
still be accessed via the `arguments` object.
> For ES6+ compatibility, the `spread` operator used via [rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) is preferred over the `arugments` object when accessing an abritrary number of function arguments.
```javascript
function argTest(one) {
console.log(one);

View File

@@ -0,0 +1,48 @@
# Break Justfile Into Separate Hidden Steps
With `just` and a project's `justfile`, I can get a summary of the commands
available to run against my project by running `just --list`. If I try to
breakdown a complex, multi-step command into separate `just` commands, it will
be nice for organization, but it will clutter the list output. I can mark
specific commands as hidden or internal by preceding them with an underscore
(`_`).
Here is a `justfile` from one of my projects that only lists a single command
`setup` which itself is supported by three internal commands: `_check-brew`,
`_install-deps`, and `_install-go-tools`.
```justfile
# Install all required development dependencies
setup: _check-brew _install-deps _install-go-tools
# Check if brew is installed
_check-brew:
#!/usr/bin/env bash
if ! command -v brew &> /dev/null; then
echo "Error: Homebrew is not installed"
echo "Please install from https://brew.sh"
exit 1
fi
brew_deps := '''
go
sqlite3
'''
# Install brew dependencies
_install-deps:
#!/usr/bin/env bash
deps=$(echo '{{brew_deps}}' | tr -s '[:space:]' ' ' | xargs)
for pkg in $deps; do
if ! brew list $pkg &>/dev/null; then
echo "Installing $pkg..."
brew install $pkg
else
echo "✓ $pkg already installed"
fi
done
# Install Go development tools
_install-go-tools:
go install github.com/pressly/goose/v3/cmd/goose@latest
```