-
-
Notifications
You must be signed in to change notification settings - Fork 52
Closed
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Feature Overview
Enable us to change $0
when executing tools like exec
's -a
option.
exec -a assumego granted "$@" # Execute granted as assumego
Why is the feature needed?
Some tools change their behavior by $0
.
For example, granted
changes the behavior based on args[0]
.
// Use a single binary to keep keychain ACLs simple, swapping behavior via argv[0]
var app *cli.App
switch filepath.Base(os.Args[0]) {
case "assumego", "assumego.exe", "dassumego", "dassumego.exe":
app = assume.GetCliApp()
default:
app = granted.GetCliApp()
}
Workaround
Create shell scripts like this.
aquaproj/aqua-registry#27177 (comment)
~/bin/assumego
#!/usr/bin/env bash
set -eu
granted=$(aqua which granted) # Get the absolute path of granted
exec -a assumego "$granted" "$@" # Execute granted changing args[0] to `assumego` by `exec -a assumego`
Example Code
registry.yaml
files:
- name: assumego
src: granted
arg0: assumego
Note
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request