Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

.toggl_project can overwrite ~/.toggl settings

  • Loading branch information...
commit a7434da316fbda9cb2229e2f9f72c22533e3bb79 1 parent a36fa29
@joequery authored
View
11 .toggl
@@ -1,6 +1,15 @@
+# Toggl CLI Settings. You can specify the following settings:
+# Email
+# Password
+# Client
+# Project.
+#
+# These will be your default settings, and can be overwritten with a
+# ~/.toggl_project in the working directory.
+
# Log in credentials for use with the Toggl command line client.
Email: YourEmail@gmail.com
# You don't have to specify your password here. If you don't, the
# program will request it at run time.
-# Password: YourPassword
+Password: YourPassword
View
12 toggl_cli/functions.py
@@ -265,10 +265,9 @@ def parse_file(fileLoc):
returnList.append(li)
return returnList
-def get_settings_from_file(keyList, fileLoc, theDict):
+def get_settings_from_file(fileLoc, theDict):
'''
- parses file at fileLoc and searches for key:value pairs specified
- by keyList.
+ parses file at fileLoc and searches for key:value pairs
Alters theDict dictionary
'''
@@ -278,11 +277,8 @@ def get_settings_from_file(keyList, fileLoc, theDict):
# used in a global variable
tmp = line.split(":")
key = tmp[0].strip().upper()
-
- # Only append the key value pair if the key is found.
- if key in keyList:
- value = tmp[1].strip()
- theDict[key] = value
+ value = tmp[1].strip()
+ theDict[key] = value
def timer_start_print(description, time):
'''
View
5 toggl_cli/global_vars.py
@@ -16,14 +16,15 @@
try:
home = os.path.expanduser("~")
fileLoc = os.path.join(home, ".toggl")
- get_settings_from_file(["EMAIL", "PASSWORD"], fileLoc, TOGGL)
+ get_settings_from_file(fileLoc, TOGGL)
except IOError:
exit("Must have a ~/.toggl file...")
# 2. a .toggl_project must exist in the directory the script is called.
+# This file can also overwrite any of the settings in ~/.toggl
try:
projectFile = os.path.join(os.getcwd(), ".toggl_project")
- get_settings_from_file(["CLIENT", "PROJECT"],projectFile, TOGGL)
+ get_settings_from_file(projectFile, TOGGL)
except IOError:
exit("Must have a .toggl_project file in this directory...")
View
7 toggl_project_example.txt
@@ -2,6 +2,13 @@
# and configure to your project specifications. A client is not mandatory,
# unless you use the same project names for different clients (which is
# not uncommon)
+# Toggl CLI Settings. You can specify the following settings:
+# Email
+# Password
+# Client
+# Project.
+#
+# These will overwrite the settings in your ~/.toggl file.
#Project: New Website
#Client: New Client
Please sign in to comment.
Something went wrong with that request. Please try again.