Skip to content

Commit

Permalink
Add at least one argument is required
Browse files Browse the repository at this point in the history
  • Loading branch information
veerendra2 committed Dec 25, 2024
1 parent bc02022 commit be8a149
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fitbit_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
fitbit_cli Module
"""

__version__ = "1.0.0"
__version__ = "1.1.0"
7 changes: 6 additions & 1 deletion fitbit_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,9 @@ def parse_arguments():
help="Show fitbit-cli version",
)

return parser.parse_args()
args = parser.parse_args()

if not any(vars(args).values()):
parser.error("No arguments provided. At least one argument is required.")

return args
6 changes: 3 additions & 3 deletions fitbit_cli/fitbit_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def fitbit_init_setup():


def read_fitbit_token():
"""Read the Fitbit token from the file and return as a JSON object."""
"""Read Fitbit token from the file and return as a JSON object."""

try:
with open(FITBIT_TOKEN_PATH, "r", encoding="utf-8") as f:
Expand All @@ -184,15 +184,15 @@ def read_fitbit_token():


def write_fitbit_token(token_content):
"""Write the Fitbit token to the file."""
"""Write Fitbit token to the file."""

Path(FITBIT_TOKEN_PATH).parent.mkdir(parents=True, exist_ok=True)
with open(FITBIT_TOKEN_PATH, "w", encoding="utf-8") as f:
json.dump(token_content, f)


def update_fitbit_token(access_token, refresh_token):
"""Update the Fitbit token in the file."""
"""Update Fitbit token in the file."""

token_content = read_fitbit_token()
token_content["access_token"] = access_token
Expand Down

0 comments on commit be8a149

Please sign in to comment.