Detailed changes
@@ -0,0 +1,10 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: rss2pleroma
+Upstream-Contact: amolith <amolith@secluded.site>
+Source: https://git.sr.ht/~amolith/rss2pleroma
+
+# Sample paragraph, commented out:
+#
+# Files: src/*
+# Copyright: $YEAR $NAME <$CONTACT>
+# License: ...
@@ -0,0 +1,9 @@
+Copyright (c) <year> <owner>
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,121 @@
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+ HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display,
+ communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+ likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+ v. rights protecting the extraction, dissemination, use and reuse of data
+ in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation
+ thereof, including any amended or successor version of such
+ directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+ world based on applicable law or treaty, and any national
+ implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+ warranties of any kind concerning the Work, express, implied,
+ statutory or otherwise, including without limitation warranties of
+ title, merchantability, fitness for a particular purpose, non
+ infringement, or the absence of latent or other defects, accuracy, or
+ the present or absence of errors, whether or not discoverable, all to
+ the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without
+ limitation any person's Copyright and Related Rights in the Work.
+ Further, Affirmer disclaims responsibility for obtaining any necessary
+ consents, permissions or other rights required for any use of the
+ Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to
+ this CC0 or use of the Work.
@@ -0,0 +1,50 @@
+<!--
+SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
+
+SPDX-License-Identifier: CC0-1.0
+-->
+
+# rss2fedi
+
+[![Go report card status][goreportcard-badge]][goreportcard]
+[![REUSE status][reuse-shield]][reuse]
+[![Donate with fosspay][fosspay-shield]][fosspay]
+[![scratchanitch.dev badge][scratchanitch-badge]][scratchanitch]
+
+_This project was created to [scratch an itch][scratchanitch]_
+
+## Installation
+
+## Usage
+
+## Questions & Contributions
+
+Questions, comments, and patches can always be sent to my public inbox, but I'm
+also in my IRC channel/XMPP room pretty much 24/7. However, I might not see
+messages right away because I'm working on something else (or sleeping) so
+please stick around!
+
+If you're wanting to introduce a new feature and I don't feel like it fits with
+this project's goal, I encourage you to fork the repo and make whatever changes
+you like!
+
+- Email: [~amolith/public-inbox@lists.sr.ht][email]
+- IRC: [irc.nixnet.services/#secluded][irc]
+- XMPP: [secluded@muc.secluded.site][xmpp]
+
+_If you haven't used mailing lists before, please take a look at [SourceHut's
+documentation](https://man.sr.ht/lists.sr.ht/), especially the etiquette
+section._
+
+[email]: mailto:~amolith/public-inbox@lists.sr.ht
+[irc]: irc://irc.nixnet.services/#secluded
+[xmpp]: xmpp:secluded@muc.secluded.site?join
+
+[goreportcard-badge]: https://goreportcard.com/badge/git.sr.ht/~amolith/rss2fedi
+[goreportcard]: https://goreportcard.com/report/git.sr.ht/~amolith/rss2fedi
+[reuse]: https://api.reuse.software/info/git.sr.ht/~amolith/rss2fedi
+[reuse-shield]: https://shields.io/reuse/compliance/git.sr.ht/~amolith/rss2fedi
+[fosspay]: https://secluded.site/donate/
+[fosspay-shield]: https://shields.io/badge/donate-fosspay-yellow
+[scratchanitch-badge]: https://img.shields.io/badge/scratchanitch-dev-FFC4B5
+[scratchanitch]: https://scratchanitch.dev
@@ -0,0 +1,19 @@
+module git.sr.ht/~amolith/rss2fedi
+
+go 1.20
+
+require (
+ github.com/mmcdole/gofeed v1.2.1
+ github.com/spf13/pflag v1.0.5
+)
+
+require (
+ github.com/PuerkitoBio/goquery v1.8.0 // indirect
+ github.com/andybalholm/cascadia v1.3.1 // indirect
+ github.com/json-iterator/go v1.1.12 // indirect
+ github.com/mmcdole/goxpp v1.1.0 // indirect
+ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+ github.com/modern-go/reflect2 v1.0.2 // indirect
+ golang.org/x/net v0.4.0 // indirect
+ golang.org/x/text v0.5.0 // indirect
+)
@@ -0,0 +1,33 @@
+github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
+github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
+github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
+github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
+github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
+github.com/mmcdole/gofeed v1.2.1 h1:tPbFN+mfOLcM1kDF1x2c/N68ChbdBatkppdzf/vDe1s=
+github.com/mmcdole/gofeed v1.2.1/go.mod h1:2wVInNpgmC85q16QTTuwbuKxtKkHLCDDtf0dCmnrNr4=
+github.com/mmcdole/goxpp v1.1.0 h1:WwslZNF7KNAXTFuzRtn/OKZxFLJAAyOA9w82mDz2ZGI=
+github.com/mmcdole/goxpp v1.1.0/go.mod h1:v+25+lT2ViuQ7mVxcncQ8ch1URund48oH+jhjiwEgS8=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
+github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
+github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU=
+golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=
+golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -0,0 +1,225 @@
+package main
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "io"
+ "log"
+ "net/http"
+ "net/url"
+ "os"
+ "strings"
+ "text/template"
+
+ "github.com/mmcdole/gofeed"
+ flag "github.com/spf13/pflag"
+ "golang.org/x/net/html"
+)
+
+var (
+ flagFeed *string = flag.StringP("feed", "f", "", "RSS/Atom feed URL (required)")
+ flagTemplate *string = flag.StringP("template", "t", "", "Template file to use, (required)")
+ flagVisibility *string = flag.StringP("visibility", "v", "", "Visibility of the post, public, unlisted, or private (required)")
+ flagLanguage *string = flag.StringP("language", "l", "en", "Language of the post, ISO 639-1 code (optional)")
+ flagSpoiler *string = flag.StringP("spoiler", "s", "", "Spoiler text for the post (optional)")
+ flagSensitive *bool = flag.BoolP("sensitive", "S", false, "Mark the post as sensitive (optional)")
+ flagAuthenticate *bool = flag.BoolP("authenticate", "a", false, "Authenticate with the server")
+ flagInstance *string = flag.StringP("instance", "i", "", "Instance to post to (required)")
+)
+
+type post struct {
+ Title string
+ Description string `json:"status"`
+ Image string `json:"media_attachments"`
+ Link string
+ Visibility string `json:"visibility"`
+ Sensitive bool `json:"sensitive"`
+ Spoiler string `json:"spoiler_text"`
+}
+
+func main() {
+ flag.Parse()
+ validateFlags()
+
+ fp := gofeed.NewParser()
+ feed, _ := fp.ParseURL(*flagFeed)
+ description, _ := htmlToPlaintext(feed.Items[0].Description)
+ description = strings.ReplaceAll(description, "\n\n", " ")
+ description = strings.ReplaceAll(description, "\n", " ")
+ splitDesc := strings.Split(description, " ")
+ if len(splitDesc) > 50 {
+ description = strings.Join(splitDesc[:50], " ")
+ }
+
+ post := post{
+ Title: feed.Items[0].Title,
+ Description: description + "...",
+ Link: feed.Items[0].Link,
+ }
+
+ if feed.Items[0].Image != nil {
+ post.Image = feed.Items[0].Image.URL
+ }
+
+ tFile, err := os.ReadFile(*flagTemplate)
+ if err != nil {
+ fmt.Println(err)
+ }
+ tmpl, err := template.New("template").Parse(string(tFile))
+ if err != nil {
+ fmt.Println(err)
+ }
+ buffer := new(strings.Builder)
+ err = tmpl.Execute(buffer, post)
+ if err != nil {
+ fmt.Println(err)
+ }
+
+ post.Description = buffer.String()
+ post.Sensitive = *flagSensitive
+ post.Spoiler = *flagSpoiler
+ post.Visibility = *flagVisibility
+
+ postBytes, err := json.Marshal(post)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+
+ client := &http.Client{}
+ req, err := http.NewRequest("POST", "https://"+*flagInstance+"/api/v1/statuses", bytes.NewBuffer(postBytes))
+ if err != nil {
+ log.Fatal(err)
+ }
+ req.Header.Set("Authorization", "Bearer "+os.Getenv("RSS2FEDI_TOKEN"))
+ req.Header.Set("Content-Type", "application/json")
+ resp, err := client.Do(req)
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer resp.Body.Close()
+ respData, err := io.ReadAll(resp.Body)
+ if err != nil {
+ log.Fatal(err)
+ }
+ respMap := make(map[string]string)
+ err = json.Unmarshal(respData, &respMap)
+ fmt.Println(respMap["url"])
+}
+
+func extractText(node *html.Node) string {
+ if node.Type == html.TextNode {
+ return node.Data
+ }
+
+ var result string
+ for child := node.FirstChild; child != nil; child = child.NextSibling {
+ result += extractText(child)
+ }
+
+ return result
+}
+
+func htmlToPlaintext(htmlString string) (string, error) {
+ doc, err := html.Parse(strings.NewReader(htmlString))
+ if err != nil {
+ return "", err
+ }
+
+ return extractText(doc), nil
+}
+
+func authenticate() {
+ v := url.Values{}
+ v.Add("client_name", "RSS2Fedi")
+ v.Add("redirect_uris", "urn:ietf:wg:oauth:2.0:oob")
+ v.Add("scopes", "write:statuses")
+ v.Add("website", "https://git.sr.ht/~amolith/rss2fedi")
+ resp, err := http.PostForm("https://"+*flagInstance+"/api/v1/apps", v)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+ defer resp.Body.Close()
+
+ defer resp.Body.Close()
+ data, err := io.ReadAll(resp.Body)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+
+ var result map[string]string
+ err = json.Unmarshal(data, &result)
+
+ fmt.Println("Visit the following URL to authenticate:")
+ fmt.Println("https://" + *flagInstance + "/oauth/authorize?client_id=" + result["client_id"] + "&response_type=code&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=write:statuses\n")
+ fmt.Print("Paste the code you receive here then press enter: ")
+ var code string
+ fmt.Scanln(&code)
+ fmt.Println()
+
+ v = url.Values{}
+ v.Add("grant_type", "authorization_code")
+ v.Add("code", code)
+ v.Add("client_id", result["client_id"])
+ v.Add("client_secret", result["client_secret"])
+ v.Add("redirect_uri", "urn:ietf:wg:oauth:2.0:oob")
+ v.Add("scope", "write:statuses")
+ resp, err = http.PostForm("https://"+*flagInstance+"/oauth/token", v)
+
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+ defer resp.Body.Close()
+
+ data, err = io.ReadAll(resp.Body)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+
+ var response map[string]string
+ err = json.Unmarshal(data, &response)
+
+ fmt.Println("Run the following command to set your token for this session:")
+ fmt.Println(" export RSS2FEDI_TOKEN=" + response["access_token"] + "")
+ fmt.Println("If using systemd, you can add the following to your service file in the [Service] section:")
+ fmt.Println(" Environment='RSS2FEDI_TOKEN=" + response["access_token"] + "'\n")
+ fmt.Println("You can now run RSS2Fedi without the authenticate flag! :)")
+
+ os.Exit(0)
+}
+
+func validateFlags() {
+ if *flagAuthenticate {
+ authenticate()
+ }
+ // Ensure the token is set
+ if os.Getenv("RSS2FEDI_TOKEN") == "" {
+ fmt.Println("No token set! Please run with the -a/--authenticate flag to obtain one.")
+ os.Exit(1)
+ }
+ if *flagFeed == "" {
+ flag.Usage()
+ panic("No feed URL specified")
+ }
+ if *flagTemplate == "" {
+ flag.Usage()
+ panic("No template file specified")
+ }
+ if *flagVisibility == "" {
+ flag.Usage()
+ panic("No visibility specified")
+ }
+ if *flagInstance == "" {
+ flag.Usage()
+ panic("No instance specified")
+ }
+ if *flagVisibility != "public" && *flagVisibility != "unlisted" && *flagVisibility != "private" && *flagVisibility != "direct" {
+ flag.Usage()
+ panic("Invalid visibility specified")
+ }
+}
@@ -0,0 +1,4 @@
+{{ .Title }}
+{{ .Link }}
+
+{{ .Description }}