Skip to content

Commit

Permalink
refactored by black
Browse files Browse the repository at this point in the history
  • Loading branch information
moiSentineL committed Jul 23, 2024
1 parent db3c66a commit 71452a3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
6 changes: 2 additions & 4 deletions flomo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,18 @@ def change(session_id: str, tag: str | None, name: str | None):
helpers.message_log(str(e))
print(e)


@flomo.command(aliases=["cf"])
def config():
"""
Print config file path
"""
try:
print(helpers.get_path("config.json", True))
except (
errors.NoConfigError
) as e:
except errors.NoConfigError as e:
helpers.message_log(str(e))
print(e)



if __name__ == "__main__":
flomo()
12 changes: 8 additions & 4 deletions flomo/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@


def get_path(file_name: str, in_data: bool = False):

conf_path = os.path.expanduser("~/Documents") if platform.system().lower() == "windows" else os.path.expanduser("~/.config")

conf_path = (
os.path.expanduser("~/Documents")
if platform.system().lower() == "windows"
else os.path.expanduser("~/.config")
)

dir_path = os.path.dirname(os.path.realpath(__file__))

Expand All @@ -22,9 +26,9 @@ def get_path(file_name: str, in_data: bool = False):
file = f"{data_folder}{sign}{file_name}"

if in_data:
return (os.path.join(conf_path + file))
return os.path.join(conf_path + file)
else:
return (os.path.join(dir_path + file))
return os.path.join(dir_path + file)


def play_sound():
Expand Down
11 changes: 8 additions & 3 deletions flomo/test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import os
import sys


def get_path(file_name: str, in_data: bool = False):
# TODO: Change data folder to documents folder (and the equivalent in other OSes).

conf_path = os.path.expanduser("~/Documents/flomo") if platform.system().lower() == "windows" else os.path.expanduser("~/.config/flomo")

conf_path = (
os.path.expanduser("~/Documents/flomo")
if platform.system().lower() == "windows"
else os.path.expanduser("~/.config/flomo")
)

dir_path = os.path.dirname(os.path.realpath(conf_path))

Expand All @@ -16,4 +21,4 @@ def get_path(file_name: str, in_data: bool = False):

file = f"{data_folder}{sign}{file_name}"

return os.path.join(dir_path + file)
return os.path.join(dir_path + file)

0 comments on commit 71452a3

Please sign in to comment.