Skip to content

Commit

Permalink
improved shortcut option
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelmerro committed Dec 25, 2018
1 parent 085ef2d commit 9e88fa8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ carafe is a tiny management tool for wine ~~bottles~~ carafes.

(carafe is both the name of the program and for a wine bottle created through this program)

## Note

#### The current command-line interface might be slightly changed, until version 1.0.0 is released

## Simple usage, get going fast

There are two example provided here,
Expand Down Expand Up @@ -122,7 +118,7 @@ All of them are listed in the output as shown here:
```
usage: carafe {<carafe_name>,list} <sub_command>
Welcome to carafe 1.0.0-beta
Welcome to carafe 1.0.0
carafe is a tiny management tool for wine bottles/carafes.
optional arguments:
Expand Down Expand Up @@ -445,13 +441,25 @@ optional arguments:
-o OUTPUT_FOLDER, --output-folder OUTPUT_FOLDER
Which folder to place the shortcut, default is the
user desktop
-n NAME, --name NAME Name of the new shortcut, default is the name of the
carafe
-t {carafe,wine}, --type {carafe,wine}
The type of shortcut to make
```

Executable location will be asked interactively when not provided as an argument,
in a fairly similar way as is done for the 'link' command.

The name of the shortcut will be set to the name of the carafe automatically,
but it can be changed with the optional --name argument like so:

`./carafe steam shortcut --name "Steam (Windows version)"`

To achieve the same but with no interactive questions,
the following command could be used to create a carafe shortcut for the linked program:

`./carafe steam shortcut --name "Steam (Windows version)" --type carafe --location link`

Some programs might create a desktop shortcut during the installation,
these type of shortcuts are made by wine and don't need carafe to work.

Expand Down
11 changes: 9 additions & 2 deletions carafe
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ __author__ = "Jelmer van Arnhem"
# See README.md for more details and usage instructions
__license__ = "MIT"
# See LICENSE for more details and exact terms
__version__ = "1.0.0-beta"
__version__ = "1.0.0"
# See https://github.com/jelmerro/carafe for repo and updates

import argparse
Expand Down Expand Up @@ -285,7 +285,11 @@ class Carafe:
shortcut_contents = self.carafe_shortcut(loc)
else:
shortcut_contents = self.wine_shortcut(loc)
output_file = os.path.join(args.output_folder, f"{self.name}.desktop")
if args.name:
file_name = f"{args.name}.desktop"
else:
file_name = f"{self.name}.desktop"
output_file = os.path.join(args.output_folder, file_name)
with open(output_file, "w") as f:
f.write(shortcut_contents)

Expand Down Expand Up @@ -514,6 +518,9 @@ if __name__ == "__main__":
"-o", "--output-folder",
default=os.path.join(os.path.expanduser("~"), "Desktop"),
help="Which folder to place the shortcut, default is the user desktop")
sub_shortcut.add_argument(
"-n", "--name",
help="Name of the new shortcut, default is the name of the carafe")
sub_shortcut.add_argument(
"-t", "--type", choices=["carafe", "wine"],
help="The type of shortcut to make")
Expand Down

0 comments on commit 9e88fa8

Please sign in to comment.