Skip to content

Commit 2e67929

Browse files
committed
Ready for release
- Updated README - Handling no intenet connection error while checking for updates
1 parent 0ebe697 commit 2e67929

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ Use the `--help` flag for instructions
2020

2121
```
2222
$ filet --help
23-
usage: filet.exe [-h] [--version] [--root [ROOT]] [--notree] struc
23+
usage: main.py [-h] [--version] [--update] [--root [ROOT]] [--notree] struc
2424
2525
optional arguments:
2626
-h, --help show this help message and exit
2727
2828
INFO:
2929
--version, -v Prints out current version and release date of Filet
30+
--update, -u Makes the update checker verbose
3031
3132
CREATE:
3233
--root [ROOT], -r [ROOT]
@@ -87,12 +88,17 @@ src/tests
8788
8889
## Updating
8990

90-
To update the version of `filet` on your computer:
91+
### Manually
9192

9293
1. Download the desired (preferably _latest_) version of `filet.exe` from the [releases](https://github.com/gitwikc/filet/releases) page.
9394
2. Save it in the directory where you have previously installed `filet`
9495
3. 🎆 YAY! You have successfully updated `filet` on your computer
9596

97+
### From CLI
98+
99+
- Filet automatically checks for updates each time it is run and will notify you about any new updates it finds.
100+
- To make the update checking process verbose, use the `--update` or `-u` flag
101+
96102
## Contributing
97103

98104
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

src/util/update.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,20 @@ def get_releases_list():
2323
return releases
2424

2525

26-
def get_available_update():
27-
latest_release = get_releases_list()[0]
26+
def get_available_update(verbose: bool = False):
27+
try:
28+
latest_release = get_releases_list()[0]
29+
except Exception as ex:
30+
if verbose:
31+
print('Something went wrong while checking for updates.')
32+
print(f'{Fore.YELLOW}Are you connected to the internet?')
33+
return False
34+
2835
current_release = get_release_info()
2936
if latest_release['name'] != current_release['version']:
3037
return latest_release
3138
else:
32-
return None
39+
return False
3340

3441

3542
def download_filet(download_url: str, dest: str):
@@ -52,7 +59,7 @@ def check_for_updates(verbose: bool = False):
5259
if verbose:
5360
spinner = Halo(text='Checking for updates...', spinner='dots')
5461
spinner.start()
55-
latest_update = get_available_update()
62+
latest_update = get_available_update(verbose)
5663
if verbose:
5764
spinner.stop()
5865

0 commit comments

Comments
 (0)