Skip to content

Commit

Permalink
Merge pull request #15 from Any0ne22/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ValekoZ authored Oct 10, 2020
2 parents 45145e5 + d9f5036 commit 75a8daa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 7 additions & 3 deletions rofipaste/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions rofipaste/rofipaste.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ")
Expand Down

0 comments on commit 75a8daa

Please sign in to comment.