Skip to content

Commit

Permalink
Fix questions ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiah-k committed Oct 12, 2024
1 parent 283bec4 commit c66a687
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions app/setup_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,20 @@ def run_setup():
download_dir = DEFAULT_CONFIG_DIR
config['DOWNLOAD_DIR'] = download_dir

# Save configuration to YAML file before setting up notifications
# Save configuration to YAML file before proceeding
with open(CONFIG_FILE, 'w') as f:
yaml.dump(config, f)

# Ask if the user wants to set up a cron job
setup_cron = input("Do you want to add a cron job to run Fetchtastic daily at 3 AM? [y/n] (default: y): ").strip().lower() or 'y'
if setup_cron == 'y':
# Install crond if not already installed
install_crond()
# Call function to set up cron job
setup_cron_job()
else:
print("Skipping cron job setup.")

# Ask if the user wants to perform a first run
perform_first_run = input("Do you want to perform a first run now? [y/n] (default: y): ").strip().lower() or 'y'
if perform_first_run == 'y':
Expand All @@ -132,14 +142,14 @@ def run_setup():
with open(CONFIG_FILE, 'w') as f:
yaml.dump(config, f)

print(f"Notifications have been set up using the topic: {ntfy_topic}")
# Ask if the user wants to copy the topic URL to the clipboard
copy_to_clipboard = input("Do you want to copy the topic URL to the clipboard? [y/n] (default: y): ").strip().lower() or 'y'
print(f"Notifications have been set up using the topic: {topic_name}")
# Ask if the user wants to copy the topic name to the clipboard
copy_to_clipboard = input("Do you want to copy the topic name to the clipboard? [y/n] (default: y): ").strip().lower() or 'y'
if copy_to_clipboard == 'y':
copy_to_clipboard_termux(ntfy_topic)
print("Topic URL copied to clipboard.")
copy_to_clipboard_termux(topic_name)
print("Topic name copied to clipboard.")
else:
print("You can copy the topic URL from above.")
print("You can copy the topic name from above.")

print("You can view your current topic at any time by running 'fetchtastic topic'.")
print("You can change the topic by running 'fetchtastic setup' again or editing the YAML file.")
Expand All @@ -150,16 +160,6 @@ def run_setup():
yaml.dump(config, f)
print("Notifications have not been set up.")

# Ask if the user wants to set up a cron job
setup_cron = input("Do you want to add a cron job to run Fetchtastic daily at 3 AM? [y/n] (default: y): ").strip().lower() or 'y'
if setup_cron == 'y':
# Install crond if not already installed
install_crond()
# Call function to set up cron job
setup_cron_job()
else:
print("Skipping cron job setup.")

def is_termux():
return 'com.termux' in os.environ.get('PREFIX', '')

Expand Down

0 comments on commit c66a687

Please sign in to comment.