Skip to content

Commit

Permalink
update some stuff, add show-analytics command
Browse files Browse the repository at this point in the history
  • Loading branch information
BennyBot committed Jan 31, 2024
1 parent 887f5bb commit a28baa3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
13 changes: 13 additions & 0 deletions pros/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ def use_analytics(ctx: click.Context, param, value):
ui.echo('Analytics set to : {}'.format(analytics.useAnalytics))
ctx.exit(0)

def show_analytics(ctx: click.Context, param, value):
ctx.ensure_object(dict)
# if analytics are currently enabled
if(analytics.useAnalytics):
ui.echo('\nAnalytics are currently ENABLED.\n')
ui.echo('DATA currently being collected is as follows:\n 1) Commands being run\n 2) Non identifying command arguments')
else:
ui.echo('\nAnalytics are currently DISABLED.')

ctx.exit(0)


@click.command('pros',
cls=PROSCommandCollection,
Expand All @@ -112,6 +123,8 @@ def use_analytics(ctx: click.Context, param, value):
callback=version)
@click.option('--use-analytics', help='Set analytics usage (True/False).', type=str, expose_value=False,
is_eager=True, default=None, callback=use_analytics)
@click.option('--show-analytics', help='Show current analytics usage.', is_flag=True, expose_value=False,
is_eager=True, default=False, callback=show_analytics)
def cli(ctx):
pros.common.sentry.register()
ctx.call_on_close(after_command)
Expand Down
10 changes: 6 additions & 4 deletions pros/ga/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,22 @@ def __init__(self):
'''

print("PROS CLI collects analytics while in use in order to better understand how people use PROS and improve this software. The data collected is as follows:\n 1) Commands being run\n 2) Non identifying command arguments\n 3) Granular location data (through google analytics).")
print("PROS CLI collects analytics while in use in order to better understand how people use PROS and improve this software. The data collected is as follows:\n 1) Commands being run\n 2) Non identifying command arguments.")
print("The scope of collected data may be expanded in the future. To see what data is actively being collected, run the command `pros --show-analytics`")
print("We do not collect any personal information, or specifics of your projects, file paths, etc.")
print("You may opt out of analytics at any time by running `pros --use-analytics False`, or may opt out for a single command by adding the `--no-analytics` flag.")
print("For questions or concerns, please contact us at [email protected]\n")
response = None
response = input("Do you choose to opt in to analytics? (y/N): ").lower()
while response not in ["y", "n"]:
print("Invalid response. Please enter y or n.")
response = input("Do you choose to opt in to analytics? (y/N): ").lower()

if response == "y":
response = "True"
print("Thank you for opting in to analytics! You may opt out at any time by running `pros --use-analytics False`, or for a specific command by adding the `--no-analytics` flag.")
print("Thank you for opting in to analytics! You may opt out at any time by running the command `pros --use-analytics False`, or for a specific command by adding the `--no-analytics` flag.")
else:
response = "False"
print("You have opted out of analytics. You may opt back in at any time by running `pros --use-analytics True`.")
print("You have opted out of analytics. You may opt back in at any time by running the command `pros --use-analytics True`.")
# Default values for GA
# generate a unix timestamp
self.cli_config.ga = {
Expand Down

0 comments on commit a28baa3

Please sign in to comment.