From 1cd3c6d5834c349e7d0b21505c4a1c23f39e9989 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Erik=20Hedenstr=C3=B6m?= <erik@hedenstroem.com>
Date: Wed, 26 Feb 2020 22:24:16 +0100
Subject: [PATCH] Initial setup

---
 .gitignore | 14 ++++++++++++++
 LICENSE    | 21 +++++++++++++++++++++
 README.md  | 11 ++++++++++-
 main.go    | 25 +++++++++++++++++++++++++
 4 files changed, 70 insertions(+), 1 deletion(-)
 create mode 100644 .gitignore
 create mode 100644 LICENSE
 create mode 100644 main.go

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cacaead
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,14 @@
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, build with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
+
+webloc
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..93c21f0
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Erik Hedenström
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/README.md b/README.md
index 9e0b786..e4d3414 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,12 @@
 # webloc
 
-Open webloc files on windows
\ No newline at end of file
+Open webloc files on windows
+
+## Installing
+
+go get -u gitlab.hedenstroem.com/go/webloc
+
+
+## Setup on Windows
+
+Double-click on a .webloc file choose open with webloc.exe
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..608c0fa
--- /dev/null
+++ b/main.go
@@ -0,0 +1,25 @@
+package main
+
+import (
+	"encoding/xml"
+	"fmt"
+	"io/ioutil"
+	"os"
+
+	"github.com/pkg/browser"
+)
+
+type Webloc struct {
+	URL string `xml:"dict>string"`
+}
+
+func main() {
+	bytes, err := ioutil.ReadFile(os.Args[1])
+	if err != nil {
+		fmt.Println("Error opening file:", err)
+		return
+	}
+	var webloc Webloc
+	xml.Unmarshal(bytes, &webloc)
+	browser.OpenURL(webloc.URL)
+}
\ No newline at end of file
-- 
GitLab