Skip to content

Commit cb12899

Browse files
committed
Add examples for cli commands
Signed-off-by: Paulo Gomes <[email protected]>
1 parent b2a32ba commit cb12899

File tree

5 files changed

+47
-7
lines changed

5 files changed

+47
-7
lines changed

cmd/cli/clipboard.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ func clipboardCommand() *cli.Command {
3030
{
3131
Name: "from-host",
3232
Usage: "copies the clipboard contents from the host to a profile",
33+
Description: `Examples:
34+
35+
qubesome clip from-host - Copy clipboard contents from host to the active profile
36+
qubesome clip from-host -type image/png - Copy image from host clipboard to the active profile
37+
qubesome clip from-host -profile <name> - Copy clipboard contents from host to a specific profile
38+
`,
3339
Arguments: []cli.Argument{
3440
&cli.StringArg{
3541
Name: "target_profile",
@@ -54,7 +60,6 @@ func clipboardCommand() *cli.Command {
5460
}
5561

5662
if typ := c.String("type"); typ != "" {
57-
fmt.Println(typ)
5863
opts = append(opts, clipboard.WithContentType(typ))
5964
}
6065

@@ -102,7 +107,6 @@ func clipboardCommand() *cli.Command {
102107
}
103108

104109
if typ := c.String("type"); typ != "" {
105-
fmt.Println(typ)
106110
opts = append(opts, clipboard.WithContentType(typ))
107111
}
108112

@@ -114,6 +118,12 @@ func clipboardCommand() *cli.Command {
114118
{
115119
Name: "to-host",
116120
Usage: "copies the clipboard contents from a profile to the host",
121+
Description: `Examples:
122+
123+
qubesome clip to-host - Copy clipboard contents from the active profile to the host
124+
qubesome clip to-host -type image/png - Copy image from the active profile clipboard to the host
125+
qubesome clip to-host -profile <name> - Copy clipboard contents from a specific profile to the host
126+
`,
117127
Arguments: []cli.Argument{
118128
&cli.StringArg{
119129
Name: "source_profile",

cmd/cli/host_run.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ func hostRunCommand() *cli.Command {
1313
Name: "host-run",
1414
Aliases: []string{"hr"},
1515
Usage: "Runs a command at the host, but shows it in a given qubesome profile",
16+
Description: `Examples:
17+
18+
qubesome host-run firefox - Run firefox on the host and display it on the active profile
19+
qubesome host-run -profile <profile> firefox - Run firefox on the host and display it on a specific profile
20+
`,
1621
Arguments: []cli.Argument{
1722
&cli.StringArg{
1823
Name: "command",

cmd/cli/run.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ func runCommand() *cli.Command {
1111
cmd := &cli.Command{
1212
Name: "run",
1313
Aliases: []string{"r"},
14+
Usage: "execute workloads",
15+
Description: `Examples:
16+
17+
qubesome run chrome - Run the chrome workload on the active profile
18+
qubesome run -profile <profile> chrome - Run the chrome workload on a specific profile
19+
`,
1420
Arguments: []cli.Argument{
1521
&cli.StringArg{
1622
Name: "workload",
@@ -29,13 +35,17 @@ func runCommand() *cli.Command {
2935
Destination: &runner,
3036
},
3137
},
32-
Usage: "execute workloads",
3338
Action: func(ctx context.Context, cmd *cli.Command) error {
34-
cfg := profileConfigOrDefault(targetProfile)
39+
prof, err := profileOrActive(targetProfile)
40+
if err != nil {
41+
return err
42+
}
43+
44+
cfg := profileConfigOrDefault(prof.Name)
3545

3646
return qubesome.Run(
3747
qubesome.WithWorkload(workload),
38-
qubesome.WithProfile(targetProfile),
48+
qubesome.WithProfile(prof.Name),
3949
qubesome.WithConfig(cfg),
4050
qubesome.WithRunner(runner),
4151
qubesome.WithExtraArgs(cmd.Args().Slice()),

cmd/cli/start.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ func startCommand() *cli.Command {
1111
cmd := &cli.Command{
1212
Name: "start",
1313
Aliases: []string{"s"},
14+
Usage: "start qubesome profiles",
15+
Description: `Examples:
16+
17+
qubesome start -git https://github.com/qubesome/sample-dotfiles awesome
18+
qubesome start -git https://github.com/qubesome/sample-dotfiles i3
19+
`,
1420
Flags: []cli.Flag{
1521
&cli.StringFlag{
1622
Name: "git",
@@ -40,7 +46,6 @@ func startCommand() *cli.Command {
4046
Destination: &targetProfile,
4147
},
4248
},
43-
Usage: "start qubesome profiles",
4449
Action: func(ctx context.Context, cmd *cli.Command) error {
4550
cfg := profileConfigOrDefault(targetProfile)
4651

cmd/cli/xdg.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ func xdgCommand() *cli.Command {
1212
Name: "xdg-open",
1313
Aliases: []string{"xdg"},
1414
Usage: "opens a file or URL in the user's configured workload",
15+
Description: `Examples:
16+
17+
qubesome xdg-open https://github.com/qubesome - Opens the URL on the workload defined on the active qubesome config
18+
qubesome xdg-open -profile <profile> https://github.com/qubesome - Opens the URL on the workload defined on the given profile's qubesome config
19+
`,
1520
Flags: []cli.Flag{
1621
&cli.StringFlag{
1722
Name: "profile",
@@ -23,7 +28,12 @@ func xdgCommand() *cli.Command {
2328
},
2429
},
2530
Action: func(ctx context.Context, cmd *cli.Command) error {
26-
cfg := profileConfigOrDefault(targetProfile)
31+
prof, err := profileOrActive(targetProfile)
32+
if err != nil {
33+
return err
34+
}
35+
36+
cfg := profileConfigOrDefault(prof.Name)
2737

2838
return qubesome.XdgRun(
2939
qubesome.WithConfig(cfg),

0 commit comments

Comments
 (0)