diff --git a/rofipaste/cli.py b/rofipaste/cli.py index 2ddeb28..80c4bba 100644 --- a/rofipaste/cli.py +++ b/rofipaste/cli.py @@ -113,14 +113,18 @@ def main(version: bool, edit_config: bool, edit_entry: bool, if edit_entry: filename = click.prompt('Please enter the filename', default="new_entry") - dirname = os.path.dirname(filename) - dirname = os.path.join(filesPath, dirname) + filename = os.path.join(filesPath, filename) + + dirname = os.path.dirname(filename) if not os.path.isdir(dirname): os.makedirs(dirname) - rofipaste.edit_file(os.path.join(filesPath, filename), editor) + if not os.path.isfile(filename): + os.mknod(filename) + + rofipaste.edit_file(filename, editor) return 0 if version: diff --git a/rofipaste/rofipaste.py b/rofipaste/rofipaste.py index 8a6aec4..2666a07 100644 --- a/rofipaste/rofipaste.py +++ b/rofipaste/rofipaste.py @@ -75,6 +75,10 @@ def commandInterpreter(cmd: str, editor: str) -> None: commands = { "config": lambda *args: edit_file(config_file_name, editor, xdg_open=True), + "help": + lambda *args: show_message( + "Available commands:\n - /help : Show this menu\n - /config : Open your config file in your default editor" + ), } if cmd[0] == command_prefix: args = cmd[1:].split(" ")