diff --git a/README.md b/README.md index b61e04c..08aeceb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,21 @@ # What Can Publify Do? +The coolest thing `publify` can do is publish a folder of static web pages and supporting assets to the web using Netlify, including adding a custom subdomain! + +Here's the full menu, though, with more details under the headings below: + +```bash +> pub help + +Usage: + pub help + pub [] --------------------------------> deploy a site + pub list -------------------------------> list all sites + pub custom --------------------------> set a custom domain + pub remove-custom -----------------------> remove a custom domain + pub delete/remove --------------------------------> delete a site +``` + ## Publish Sites to Netlify via CLI! ```bash @@ -30,10 +46,57 @@ the site is published: http://642718842cb34f02bc6b0137--cheery-daifuku-f3417f.ne the site is published at dudette.helpers.fun. ``` +## List All Your Sites! + +```bash +> pub list + +sites without custom domains: + +cheery-daifuku-f3417f: https://cheery-daifuku-f3417f.netlify.app +preeminent-salamander-6262a7: http://preeminent-salamander-6262a7.netlify.app +scintillating-mochi-760bd3: https://scintillating-mochi-760bd3.netlify.app +transcribely: https://transcribely.netlify.app + +sites with custom domains: + +euphonious-torrone-029b78: https://shucks.helpers.fun +flourishing-sherbet-8f356e: https://dudettes.helpers.fun +beautiful-meerkat-95c24f: https://duasdfdes.helpers.fun +glittery-khapse-b51104: https://dudes.helpers.fun +velvety-cobbler-d4e023: https://mama.helpers.fun +playful-treacle-6fea54: https://okay.helpers.fun +calm-dodol-b7aea3: https://thedonkey.helpers.fun +``` + ## Add A Custom Subdomain To An Already Published Site! ```bash -> pub custom hey.helpers.fun startling-gingersnap-425138.netlify.app +> pub custom hey.helpers.fun preeminent-salamander-6262a7.netlify.app +the site is published at hey.helpers.fun. (originally 'preeminent-salamander-6262a7.netlify.app') +``` + +You can also provide partial names for the Netlify URLs, and also for the custom domains if you only have one domain listed in `NETLIFY_DOMAINS`: + +```bash +> pub custom hey preeminent +the site is published at hey.helpers.fun. (originally 'preeminent-salamander-6262a7.netlify.app') +``` + +## Remove a Custom Subdomain! + +```bash +> pub remove-custom hey +'hey.helpers.fun' was removed +``` + +## Delete An Entire Site! + +Powerful stuff: + +```bash +> pub delete preeminent +site 'http://preeminent-salamander-6262a7.netlify.app' was deleted ``` @@ -44,3 +107,9 @@ To do this magic, you have to first 1) Create an environment variable `NETLIFY_TOKEN`, obtained [here](https://app.netlify.com/user/applications#personal-access-tokens). 1) Create an environment variable `NETLIFY_DOMAINS`, with comma-separated values (no spaces), if you're planning to use custom domains. 1) Delegate DNS management of all domains listed in `DOMAINS` to Netlify ([link](https://docs.netlify.com/domains-https/netlify-dns/delegate-to-netlify/)) + +# TODO + +- [ ] add support for partial updates, so it's not only about subdomains, but also `/sub-pages` +- [ ] add some color and spinners to the CLI using Rich + diff --git a/publify/publify.py b/publify/publify.py index 31c6e67..0636619 100644 --- a/publify/publify.py +++ b/publify/publify.py @@ -65,7 +65,7 @@ def cli_set_custom_domain(custom_domain: str, domain: str) -> None: """ check_that_custom_domain_is_not_in_use(custom_domain) try: - site_id, _ = get_site_id_from_netlify_domain(domain) + site_id, domain = get_site_id_from_netlify_domain(domain) except NoResult: print(f"No site found with domain '{domain}'") return