| 1 |
package main |
| 2 |
|
| 3 |
import ( |
| 4 |
"github.com/charmbracelet/huh" |
| 5 |
) |
| 6 |
|
| 7 |
func main() { |
| 8 |
var ( |
| 9 |
name string |
| 10 |
address string |
| 11 |
country string |
| 12 |
email string |
| 13 |
) |
| 14 |
|
| 15 |
huh.NewForm( |
| 16 |
huh.NewGroup( |
| 17 |
huh.NewNote(). |
| 18 |
Title("\nStickers pls."). |
| 19 |
Description("Make sure to fill out the address exactly\nas it would appear on a parcel."), |
| 20 |
huh.NewInput(). |
| 21 |
Title("Full name"). |
| 22 |
Validate(huh.ValidateMinLength(1)). |
| 23 |
Value(&name), |
| 24 |
huh.NewSelect[string](). |
| 25 |
Title("Country "). |
| 26 |
Height(1). |
| 27 |
Value(&country). |
| 28 |
Inline(true). |
| 29 |
Options(countries...), |
| 30 |
huh.NewText(). |
| 31 |
Title("Address"). |
| 32 |
Lines(2). |
| 33 |
Description("Use your country's postal format."). |
| 34 |
Value(&address), |
| 35 |
huh.NewInput(). |
| 36 |
Title("Email"). |
| 37 |
Description("Optional: so we can send you updates."). |
| 38 |
Value(&email), |
| 39 |
), |
| 40 |
).Run() |
| 41 |
} |
| 42 |
|
| 43 |
var countries = huh.NewOptions( |
| 44 |
|
| 45 |
"United States", |
| 46 |
"Canada", |
| 47 |
"Germany", |
| 48 |
"Brazil", |
| 49 |
"Mexico", |
| 50 |
"China", |
| 51 |
"India", |
| 52 |
|
| 53 |
"Afghanistan", |
| 54 |
"Albania", |
| 55 |
"Algeria", |
| 56 |
"American Samoa", |
| 57 |
"Andorra", |
| 58 |
"Angola", |
| 59 |
"Anguilla", |
| 60 |
"Antarctica", |
| 61 |
"Antigua and Barbuda", |
| 62 |
"Argentina", |
| 63 |
"Armenia", |
| 64 |
"Aruba", |
| 65 |
"Australia", |
| 66 |
"Austria", |
| 67 |
"Azerbaijan", |
| 68 |
"Ã…land Islands", |
| 69 |
"Bahamas", |
| 70 |
"Bahrain", |
| 71 |
"Bangladesh", |
| 72 |
"Barbados", |
| 73 |
"Belarus", |
| 74 |
"Belgium", |
| 75 |
"Belize", |
| 76 |
"Benin", |
| 77 |
"Bermuda", |
| 78 |
"Bhutan", |
| 79 |
"Bolivia", |
| 80 |
"Bosnia and Herzegovina", |
| 81 |
"Botswana", |
| 82 |
"Bouvet Island", |
| 83 |
"British Indian Ocean Territory", |
| 84 |
"British Virgin Islands", |
| 85 |
"Brunei", |
| 86 |
"Bulgaria", |
| 87 |
"Burkina Faso", |
| 88 |
"Burundi", |
| 89 |
"Cambodia", |
| 90 |
"Cameroon", |
| 91 |
"Cape Verde", |
| 92 |
"Caribbean Netherlands", |
| 93 |
"Cayman Islands", |
| 94 |
"Central African Republic", |
| 95 |
"Chad", |
| 96 |
"Chile", |
| 97 |
"Christmas Island", |
| 98 |
"Cocos (Keeling) Islands", |
| 99 |
"Colombia", |
| 100 |
"Comoros", |
| 101 |
"Cook Islands", |
| 102 |
"Costa Rica", |
| 103 |
"Croatia", |
| 104 |
"Cuba", |
| 105 |
"Curaçao", |
| 106 |
"Cyprus", |
| 107 |
"Czechia", |
| 108 |
"DR Congo", |
| 109 |
"Denmark", |
| 110 |
"Djibouti", |
| 111 |
"Dominica", |
| 112 |
"Dominican Republic", |
| 113 |
"Ecuador", |
| 114 |
"Egypt", |
| 115 |
"El Salvador", |
| 116 |
"Equatorial Guinea", |
| 117 |
"Eritrea", |
| 118 |
"Estonia", |
| 119 |
"Eswatini", |
| 120 |
"Ethiopia", |
| 121 |
"Falkland Islands", |
| 122 |
"Faroe Islands", |
| 123 |
"Fiji", |
| 124 |
"Finland", |
| 125 |
"France", |
| 126 |
"French Guiana", |
| 127 |
"French Polynesia", |
| 128 |
"French Southern and Antarctic Lands", |
| 129 |
"Gabon", |
| 130 |
"Gambia", |
| 131 |
"Georgia", |
| 132 |
"Ghana", |
| 133 |
"Gibraltar", |
| 134 |
"Greece", |
| 135 |
"Greenland", |
| 136 |
"Grenada", |
| 137 |
"Guadeloupe", |
| 138 |
"Guam", |
| 139 |
"Guatemala", |
| 140 |
"Guernsey", |
| 141 |
"Guinea", |
| 142 |
"Guinea-Bissau", |
| 143 |
"Guyana", |
| 144 |
"Haiti", |
| 145 |
"Heard Island and McDonald Islands", |
| 146 |
"Honduras", |
| 147 |
"Hong Kong", |
| 148 |
"Hungary", |
| 149 |
"Iceland", |
| 150 |
"Indonesia", |
| 151 |
"Iran", |
| 152 |
"Iraq", |
| 153 |
"Ireland", |
| 154 |
"Isle of Man", |
| 155 |
"Israel", |
| 156 |
"Italy", |
| 157 |
"Ivory Coast", |
| 158 |
"Jamaica", |
| 159 |
"Japan", |
| 160 |
"Jersey", |
| 161 |
"Jordan", |
| 162 |
"Kazakhstan", |
| 163 |
"Kenya", |
| 164 |
"Kiribati", |
| 165 |
"Kosovo", |
| 166 |
"Kuwait", |
| 167 |
"Kyrgyzstan", |
| 168 |
"Laos", |
| 169 |
"Latvia", |
| 170 |
"Lebanon", |
| 171 |
"Lesotho", |
| 172 |
"Liberia", |
| 173 |
"Libya", |
| 174 |
"Liechtenstein", |
| 175 |
"Lithuania", |
| 176 |
"Luxembourg", |
| 177 |
"Macau", |
| 178 |
"Madagascar", |
| 179 |
"Malawi", |
| 180 |
"Malaysia", |
| 181 |
"Maldives", |
| 182 |
"Mali", |
| 183 |
"Malta", |
| 184 |
"Marshall Islands", |
| 185 |
"Martinique", |
| 186 |
"Mauritania", |
| 187 |
"Mauritius", |
| 188 |
"Mayotte", |
| 189 |
"Micronesia", |
| 190 |
"Moldova", |
| 191 |
"Monaco", |
| 192 |
"Mongolia", |
| 193 |
"Montenegro", |
| 194 |
"Montserrat", |
| 195 |
"Morocco", |
| 196 |
"Mozambique", |
| 197 |
"Myanmar", |
| 198 |
"Namibia", |
| 199 |
"Nauru", |
| 200 |
"Nepal", |
| 201 |
"Netherlands", |
| 202 |
"New Caledonia", |
| 203 |
"New Zealand", |
| 204 |
"Nicaragua", |
| 205 |
"Niger", |
| 206 |
"Nigeria", |
| 207 |
"Niue", |
| 208 |
"Norfolk Island", |
| 209 |
"North Korea", |
| 210 |
"North Macedonia", |
| 211 |
"Northern Mariana Islands", |
| 212 |
"Norway", |
| 213 |
"Oman", |
| 214 |
"Pakistan", |
| 215 |
"Palau", |
| 216 |
"Palestine", |
| 217 |
"Panama", |
| 218 |
"Papua New Guinea", |
| 219 |
"Paraguay", |
| 220 |
"Peru", |
| 221 |
"Philippines", |
| 222 |
"Pitcairn Islands", |
| 223 |
"Poland", |
| 224 |
"Portugal", |
| 225 |
"Puerto Rico", |
| 226 |
"Qatar", |
| 227 |
"Republic of the Congo", |
| 228 |
"Romania", |
| 229 |
"Russia", |
| 230 |
"Rwanda", |
| 231 |
"São Tomé and PrÃncipe", |
| 232 |
"Saint Barthélemy", |
| 233 |
"Saint Helena, Ascension and Tristan da Cunha", |
| 234 |
"Saint Kitts and Nevis", |
| 235 |
"Saint Lucia", |
| 236 |
"Saint Martin", |
| 237 |
"Saint Pierre and Miquelon", |
| 238 |
"Saint Vincent and the Grenadines", |
| 239 |
"Samoa", |
| 240 |
"San Marino", |
| 241 |
"Saudi Arabia", |
| 242 |
"Senegal", |
| 243 |
"Serbia", |
| 244 |
"Seychelles", |
| 245 |
"Sierra Leone", |
| 246 |
"Singapore", |
| 247 |
"Sint Maarten", |
| 248 |
"Slovakia", |
| 249 |
"Slovenia", |
| 250 |
"Solomon Islands", |
| 251 |
"Somalia", |
| 252 |
"South Africa", |
| 253 |
"South Georgia", |
| 254 |
"South Korea", |
| 255 |
"South Sudan", |
| 256 |
"Spain", |
| 257 |
"Sri Lanka", |
| 258 |
"Sudan", |
| 259 |
"Suriname", |
| 260 |
"Svalbard and Jan Mayen", |
| 261 |
"Sweden", |
| 262 |
"Switzerland", |
| 263 |
"Syria", |
| 264 |
"Taiwan", |
| 265 |
"Tajikistan", |
| 266 |
"Tanzania", |
| 267 |
"Thailand", |
| 268 |
"Timor-Leste", |
| 269 |
"Togo", |
| 270 |
"Tokelau", |
| 271 |
"Tonga", |
| 272 |
"Trinidad and Tobago", |
| 273 |
"Tunisia", |
| 274 |
"Turkey", |
| 275 |
"Turkmenistan", |
| 276 |
"Turks and Caicos Islands", |
| 277 |
"Tuvalu", |
| 278 |
"Uganda", |
| 279 |
"Ukraine", |
| 280 |
"United Arab Emirates", |
| 281 |
"United Kingdom", |
| 282 |
"United States Minor Outlying Islands", |
| 283 |
"United States Virgin Islands", |
| 284 |
"Uruguay", |
| 285 |
"Uzbekistan", |
| 286 |
"Vanuatu", |
| 287 |
"Vatican City", |
| 288 |
"Venezuela", |
| 289 |
"Vietnam", |
| 290 |
"Wallis and Futuna", |
| 291 |
"Western Sahara", |
| 292 |
"Yemen", |
| 293 |
"Zambia", |
| 294 |
"Zimbabwe", |
| 295 |
) |