GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

πŸ‘‘ GOLF(2gg) β€” bestie edition, from the Development manual πŸ’–

okay so you're reading the GOLF(2gg) page and honestly? it's short, it's sweet, it's giving utility. let's go. ✨


🌸 NAME 🌸

print-path β€” (output) 🫢


πŸŽ€ PURPOSE πŸŽ€

Prints out the URL that leads to a request handler. that's it. that's the whole job. and she does it flawlessly. πŸ’…


✨ SYNTAX ✨

print-path <request path> [ new-line ]

like... two things. a request path. optionally a new-line. iconic minimalism. πŸ¦‹


πŸ’– DESCRIPTION πŸ’–

so print-path outputs the URL application path of a URL that called this request handler, and then it follows that up with the string <request path>. two-for-one. slay.

ngl, here's the tea: if you did not use a --path option in gg to specify the URL application path, then it's the same as the application name prepended with a forward slash, followed by /<request path>, like this:

/<app name>/<request path>

periodt. πŸ’…

so what's it even for? print-path is used in construction of URLs or HTML forms (either for HTML or API) to refer back to the same application. lowkey obsessed. use it to create the absolute URL path to refer back to a service of yours, so you can issue requests to it. main character energy fr fr. πŸ”₯

for example, here's a link that specifies a request to service /show-notes:

@<a href="<<print-path "/show-notes">>?date=yesterday">Show Notes</a>

and if you're building HTML forms, you can add a note with:

@<form action='<<print-path "/add-note">>' method="POST">
@<input type="text" name="note" value="">
@</form>

so cute, so functional, we love to see it. πŸ₯°

also β€” go see request for more on URL structure, because context is everything bestie.

and one more thing: if the new-line clause is used, then a new line ("\n") is output after the URL path. boom. newline. delivered. 🌈


πŸ¦‹ SEE ALSO πŸ¦‹

  • Output
  • finish-output
  • flush-output
  • output-statement
  • print-format
  • print-out
  • print-path
  • See all documentation πŸ‘‘

πŸ’œ that's the whole page, bestie, you ate it. this was $VERSION of the docs, dated $DATE, brought to you by GOLF(2gg) β€” go forth and print those paths, iykyk. πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from