8356
Wx
www-xonecas-io / files
www-xonecas-io / cmd / site / help.go
1.8 KB
1package main 2 3import ( 4 "flag" 5 "fmt" 6 "io" 7) 8 9// usage is what site help prints. Run site from the site folder, where sources.txt is. 10const usage = `site serves xonecas.io from git repos. Run it in the site folder; README.md has more. 11 12Repos 13 site remote list list the repos the site shows 14 site remote new <name> make a repo to git push to over SSH (a first push makes one too) 15 site remote add <path or url> show a repo you already have: a local path or any https URL 16 site remote rm <path or url> stop showing a repo (a pushed repo's data is kept) 17 18Site 19 site import fetch every added remote again 20 site index read the repos into data/projects.json 21 site serve serve the site on :8080, from the repos and data/projects.json 22 site -c <command> what login-shell runs for git push, git clone and remote 23 24 site <command> -h a command's flags 25 26Set up pushing, once, on the server 27 make login-shell in the site folder, as the user that owns it; README.md says what it changes 28 29Push a new repo, from any machine 30 git remote add origin sean@xonecas.io:my-thing.git 31 git push -u origin main the first push creates the repo; each push updates the site 32 ssh sean@xonecas.io remote list the same remote commands, over SSH 33 34Show a repo you already have 35 bin/site remote add ~/code/other-thing 36 bin/site index the site shows it on the next request 37 38See the site 39 make serve then open http://vm:8080 40` 41 42// printUsage writes the usage, then fs's flags when there is a command. 43func printUsage(w io.Writer, fs *flag.FlagSet) { 44 fmt.Fprint(w, usage) 45 if fs != nil { 46 fmt.Fprintf(w, "\nFlags of site %s\n", fs.Name()) 47 fs.SetOutput(w) 48 fs.PrintDefaults() 49 } 50}