-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New
host-run
command, CLI improvements and use of gRPC for inception (
#7) Key changes: - Add new `host-run` that allows running commands on host to be displayed on a given qubesome profile. - Examples were added to the CLI help for most commands. - Add profile inference to some commands, so that it is more user friendly. So when a single profile is running, users won't need to type them. Example: `qubesome clip from-host`. - Profiles have a connection with the qubesome process at the host, which enables it from triggering workload execution from the profile itself. That communication is now established via gRPC based on a Unix socket.
- Loading branch information
Showing
24 changed files
with
915 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ linters: | |
- bidichk | ||
- bodyclose | ||
- containedctx | ||
- contextcheck | ||
- decorder | ||
- dogsled | ||
- dupl | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package cli | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"os/exec" | ||
|
||
"github.com/urfave/cli/v3" | ||
) | ||
|
||
func hostRunCommand() *cli.Command { | ||
cmd := &cli.Command{ | ||
Name: "host-run", | ||
Aliases: []string{"hr"}, | ||
Usage: "Runs a command at the host, but shows it in a given qubesome profile", | ||
Description: `Examples: | ||
qubesome host-run firefox - Run firefox on the host and display it on the active profile | ||
qubesome host-run -profile <profile> firefox - Run firefox on the host and display it on a specific profile | ||
`, | ||
Arguments: []cli.Argument{ | ||
&cli.StringArg{ | ||
Name: "command", | ||
Min: 1, | ||
Max: 1, | ||
Destination: &commandName, | ||
}, | ||
}, | ||
Flags: []cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "profile", | ||
Usage: "Required when multiple profiles are active", | ||
Destination: &targetProfile, | ||
}, | ||
}, | ||
Action: func(ctx context.Context, cmd *cli.Command) error { | ||
prof, err := profileOrActive(targetProfile) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
c := exec.Command(commandName) | ||
c.Env = append(c.Env, fmt.Sprintf("DISPLAY=:%d", prof.Display)) | ||
out, err := c.CombinedOutput() | ||
fmt.Println(out) | ||
|
||
return err | ||
}, | ||
} | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.