Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enhanced execution format #45

Merged
merged 11 commits into from
Aug 12, 2023
Merged

feat: enhanced execution format #45

merged 11 commits into from
Aug 12, 2023

Conversation

sxyazi
Copy link
Owner

@sxyazi sxyazi commented Aug 10, 2023

The new enhanced exec format will be shipped with Yazi v0.1.3, the old format will still be available until v0.1.5.

Mainly affects opener rules, you should be able to switch between them easily:

[opener]
archive = [
	{ cmd = "unar", args = [ "$0" ] },
]
text = [
	{ cmd = "nvim", args = [ "$*" ], block = true },
]
# ...

to

[opener]
archive = [
	{ exec = 'unar "$1"' },
]
text = [
	{ exec = 'nvim "$@"', block = true },
]
# ...

This makes more complex cases possible, such as:

[opener]
video = [
	{
		exec = '''mediainfo "$1"; echo "PRESS ENTER TO EXIT"; read''',
		block = true,
		display_name = "Show media info"
	},
]

Note: To keep the compatibility with shell, the first argument of the new format is $1 instead of $0, the second is $2, and so on. The old format will not be affected.

@sxyazi sxyazi merged commit d881614 into main Aug 12, 2023
@sxyazi sxyazi deleted the pr-aa6d454e branch August 12, 2023 09:48
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant