Command line interface¶
A command line interface (CLI) is available to manage database, OAuth2 tokens, users and workouts archive uploads.
$ ftcli
Usage: ftcli [OPTIONS] COMMAND [ARGS]...
FitTrackee Command Line Interface
Options:
--help Show this message and exit.
Commands:
db Manage database.
oauth2 Manage OAuth2 tokens.
users Manage users.
workouts Manage workouts.
Database¶
ftcli db drop
¶
Added in version 0.6.5.
Empty database and delete uploaded files, only on development environments.
ftcli db upgrade
¶
Added in version 0.6.5.
Apply migrations.
OAuth2¶
ftcli oauth2 clean
¶
Added in version 0.7.0.
Remove tokens expired for more than provided number of days
Options |
Description |
---|---|
|
Number of days. |
Users¶
ftcli users clean_archives
¶
Added in version 0.7.13.
Delete export requests and related archives created more than provided number of days.
Options |
Description |
---|---|
|
Number of days. |
ftcli users clean_tokens
¶
Added in version 0.7.0.
Remove blacklisted tokens expired for more than provided number of days.
Options |
Description |
---|---|
|
Number of days. |
ftcli users create
¶
Added in version 0.7.15.
Changed in version 0.8.4: User preference for interface language is added.
Changed in version 0.9.0: Add option for user role.
Changed in version 0.9.4: User preference for timezone is added.
Create a user account.
Note
the newly created account is already active.
the CLI allows to create users when registration is disabled.
Arguments/options |
Description |
---|---|
|
Username. |
|
User email (mandatory). |
|
User password (if not provided, a random password is generated). |
|
User preference for interface language (two-letter code, ISO 639-1). If not provided or not supported, it falls back to English (‘en’). |
|
User preference for timezone. If not provided or not supported, it falls back to ‘Europe/Paris’. |
|
User role (default: ‘user’). |
ftcli users export_archive
¶
Added in version 0.10.0.
Process a given queued user data export.
Can be used if redis is not set (no dramatiq workers running).
Options |
Description |
---|---|
|
Id of task to process. |
ftcli users export_archives
¶
Added in version 0.7.13.
Process incomplete user export requests.
Can be used if redis is not set (no dramatiq workers running).
Options |
Description |
---|---|
|
Maximum number of export requests to process. |
ftcli users update
¶
Added in version 0.6.5.
Changed in version 0.9.0: Add --set-role
option. --set-admin
is now deprecated.
Modify a user account (role, active status, email and password).
Arguments/options |
Description |
---|---|
|
Username. |
|
[DEPRECATED] Add/remove admin rights (when adding admin rights, it also activates user account if not active). |
|
Set user role (when setting ‘moderator’, ‘admin’ and ‘owner’ role, it also activates user account if not active). |
|
Activate user account. |
|
Reset user password (a new password will be displayed). |
|
New user email. |
Workouts¶
ftcli workouts archive_upload
¶
Added in version 0.10.0.
Process a given queued workouts archive upload.
Can be used if redis is not set (no dramatiq workers running).
Options |
Description |
---|---|
|
Id of task to process. |
ftcli workouts archive_uploads
¶
Added in version 0.10.0.
Process workouts archive uploads if queued tasks exist (progress = 0 and not aborted/errored).
Can be used if redis is not set (no dramatiq workers running).
Options |
Description |
---|---|
|
Maximum number of workouts archive to process. |
ftcli workouts refresh
¶
Added in version 0.12.0.
Refresh workouts by recalculating data and fetching weather data if provider is set and workout does not have weather data.
Before executing the command, it is recommended to back up of all data (database and upload directory) in case a large number of workouts are refreshed.
Warning
If a weather data provider is defined and the --with-weather
option is provided, the rate limit may be reached, resulting in API rate limit errors when a large number of workouts is refreshed.
Options |
Description |
---|---|
|
sport id |
|
start date (format: |
|
end date (format: |
|
number of workouts per page (default: 10) |
|
page number (default: 1) |
|
workout date order: ‘asc’ or ‘desc’ (default: ‘asc’) |
|
username of workouts owner |
|
workout file extension (valid values are: tcx, kmz, gpx, kml, fit) |
|
enable weather data collection if weather provider is set and workout has no weather data. WARNING: depending on subscription, the rate limit can be reached, leading to errors and preventing weather data being collected during next uploads until the limit is reset (default: disabled) |
|
Enable verbose output log (default: disabled) |