~humaid/whatsmorse

3e6b91540203e2714739ba1719259f19ec591ed0 — Humaid AlQassimi 1 year, 4 months ago 5016d46
Convert to Go modules from govendor
A go.mod => go.mod +14 -0
@@ 0,0 1,14 @@
module git.sr.ht/~humaid/whatsmorse

go 1.13

require (
	github.com/Unknwon/com v0.0.0-20170819223952-7677a1d7c113 // indirect
	github.com/go-macaron/inject v0.0.0-20160627170012-d8a0b8677191 // indirect
	github.com/go-macaron/session v0.0.0-20170320172209-b8e286a0dba8
	github.com/hellworld-io/morseGo v0.0.0-20170411043521-ef46ece6471a // indirect
	github.com/pravj/morser v0.0.0-20150915083409-ad33f5cefb7e // indirect
	golang.org/x/crypto v0.0.0-20171231215028-0fcca4842a8d // indirect
	gopkg.in/ini.v1 v1.32.0 // indirect
	gopkg.in/macaron.v1 v1.2.4
)

A go.sum => go.sum +14 -0
@@ 0,0 1,14 @@
github.com/Unknwon/com v0.0.0-20170819223952-7677a1d7c113 h1:YwXm6KwmrA5R5yJRhcnpqRUHmBXSKciHuWtK9zP5qKQ=
github.com/Unknwon/com v0.0.0-20170819223952-7677a1d7c113/go.mod h1:KYCjqMOeHpNuTOiFQU6WEcTG7poCJrUs0YgyHNtn1no=
github.com/go-macaron/inject v0.0.0-20160627170012-d8a0b8677191 h1:NjHlg70DuOkcAMqgt0+XA+NHwtu66MkTVVgR4fFWbcI=
github.com/go-macaron/inject v0.0.0-20160627170012-d8a0b8677191/go.mod h1:VFI2o2q9kYsC4o7VP1HrEVosiZZTd+MVT3YZx4gqvJw=
github.com/go-macaron/session v0.0.0-20170320172209-b8e286a0dba8 h1:YIbILaZ2IycFbMhPG35oBews3Tt5HWNTW7xhEEXvEtE=
github.com/go-macaron/session v0.0.0-20170320172209-b8e286a0dba8/go.mod h1:ScEJm9Gk+ez5JJTml5WlBIqavAfuE5nF8e4Gvyz/X+A=
github.com/hellworld-io/morseGo v0.0.0-20170411043521-ef46ece6471a/go.mod h1:/wX/WwQOWBs7SkntN+K7/vFZy2b8q68iwdPZq0363Zw=
github.com/pravj/morser v0.0.0-20150915083409-ad33f5cefb7e/go.mod h1:eNlJrwRGY/Iogv5PVryuMCsvNK5iaqu8ApyeLP4wwvs=
golang.org/x/crypto v0.0.0-20171231215028-0fcca4842a8d h1:GrqEEc3+MtHKTsZrdIGVoYDgLpbSRzW1EF+nLu0PcHE=
golang.org/x/crypto v0.0.0-20171231215028-0fcca4842a8d/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
gopkg.in/ini.v1 v1.32.0 h1:9yR997mcSrhXxgxItwowxJCmCTrSSlnSN8FEbuXHFP0=
gopkg.in/ini.v1 v1.32.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/macaron.v1 v1.2.4 h1:hBOy4AsYKd4lC59YjpDl7MGXEss+JYhH8aF/fXf/Cc4=
gopkg.in/macaron.v1 v1.2.4/go.mod h1:PrsiawTWAGZs6wFbT5hlr7SQ2Ns9h7cUVtcUu4lQOVo=

A vendor/github.com/Unknwon/com/.gitignore => vendor/github.com/Unknwon/com/.gitignore +24 -0
@@ 0,0 1,24 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so

# Folders
_obj
_test
.idea

# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out

*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*

_testmain.go

*.exe
*.iml

A vendor/github.com/Unknwon/com/.travis.yml => vendor/github.com/Unknwon/com/.travis.yml +13 -0
@@ 0,0 1,13 @@
language: go

go:
  - 1.2
  - 1.3
  - 1.4
  - tip

install: go get -v -t

notifications:
  email:
    - u@gogs.io
\ No newline at end of file

A vendor/github.com/go-macaron/inject/.travis.yml => vendor/github.com/go-macaron/inject/.travis.yml +14 -0
@@ 0,0 1,14 @@
sudo: false
language: go

go:
  - 1.3
  - 1.4
  - 1.5
  - tip

script: go test -v -cover -race

notifications:
  email:
    - u@gogs.io

A vendor/github.com/go-macaron/session/.gitignore => vendor/github.com/go-macaron/session/.gitignore +2 -0
@@ 0,0 1,2 @@
ledis/tmp.db
nodb/tmp.db
\ No newline at end of file

A vendor/github.com/go-macaron/session/.travis.yml => vendor/github.com/go-macaron/session/.travis.yml +16 -0
@@ 0,0 1,16 @@
sudo: false
language: go

go:
  - 1.4
  - 1.5
  - 1.6
  - 1.7
  - 1.8
  - tip

script: go test -v -cover -race

notifications:
  email:
    - u@gogs.io

D vendor/github.com/hellworld-io/morseGo/README.md => vendor/github.com/hellworld-io/morseGo/README.md +0 -30
@@ 1,30 0,0 @@
# MorseGo

### `MorseGo` is written  by golang. It is a simple command line for converting Morse Code or text.

## What Morse Code?

### [Morse Code](https://en.wikipedia.org/wiki/Morse_code)

## How to use it

### This is able to convert from words to morse code, or convert from morse code to words.
```
./morse
Usage of morse:
    convert -morse string
        morse code to text ex) morse convert -morse '. .-  . .-'
    convert -text string
        Text to morse code ex) morse convert -text 'a b'
```

### There are results about running morse.
```
go run morse.go convert -text 'abc d' -morse '.- -... -.-.  -..'


converted text : .- -... -.-.  -..  
converted morse code : abc d
```



D vendor/github.com/hellworld-io/morseGo/morse.go => vendor/github.com/hellworld-io/morseGo/morse.go +0 -21
@@ 1,21 0,0 @@
package main

import (
	"morseGo/flags"
	"fmt"
	"morseGo/jsons"
	"morseGo/constants"
	"path"
)

func main() {
	morseJson := new(jsons.MorseJson)
	dataFilePath := path.Join("datas", constants.MorseDataFile)
	morseJson.ReadJsonData(dataFilePath)

	textArgs, morseArgs := flags.SetFlags()

	resultText, resultMorse := morseJson.Convert(textArgs, morseArgs)

	fmt.Printf("converted text : %s \nconverted morse code : %s\n",resultMorse, resultText)
}

D vendor/github.com/pravj/morser/README.md => vendor/github.com/pravj/morser/README.md +0 -14
@@ 1,14 0,0 @@
morser
======
> Plaintext to 'Morse code' encoder in golang, based on ITU standards

## Supported Input

> **morser** follows input standards provided by International Telecommunication Union, reference [ITU-R M.1677-1](http://www.itu.int/dms_pubrec/itu-r/rec/m/R-REC-M.1677-1-200910-I!!PDF-E.pdf).

* Alphabets - [A-Z]
* Decimals - [0-9]
* Punctuation marks - [.,:?'-/()+×@]

## LICENSE
MIT © [Pravendra Singh](http://pravj.github.io)

D vendor/github.com/pravj/morser/morser.go => vendor/github.com/pravj/morser/morser.go +0 -132
@@ 1,132 0,0 @@
// Package main implements a plaintext to morse-code encoder
package main

// import required packages
import (
	"fmt"
	"errors"
	"flag"
	"os"
	"strings"
	"bytes"
)

// errorHandler prints out(and terminates) an error according to the error-log argument
func errorHandler(errorLog string) {
	err := errors.New(errorLog)
	fmt.Println(err)
	os.Exit(1)
}

// translateInput parses the STDIN data and translates it into morse code
func translateInput(args []string) {
	// map that holds character to morse code mapping
	reverseMap := make(map[string]string)

	// Alphabates
	reverseMap["A"] = ".-"
	reverseMap["B"] = "-..."
	reverseMap["C"] = "-.-."
	reverseMap["D"] = "-.."
	reverseMap["E"] = "."
	reverseMap["F"] = "..-."
	reverseMap["G"] = "--."
	reverseMap["H"] = "...."
	reverseMap["I"] = ".."
	reverseMap["J"] = ".---"
	reverseMap["K"] = "-.-"
	reverseMap["L"] = ".-.."
	reverseMap["M"] = "--"
	reverseMap["N"] = "-."
	reverseMap["O"] = "---"
	reverseMap["P"] = ".--."
	reverseMap["Q"] = "--.-"
	reverseMap["R"] = ".-."
	reverseMap["S"] = "..."
	reverseMap["T"] = "-"
	reverseMap["U"] = "..-"
	reverseMap["V"] = "...-"
	reverseMap["W"] = ".--"
	reverseMap["X"] = "-..-"
	reverseMap["Y"] = "-.--"
	reverseMap["Z"] = "--.."

	// Decimals
	reverseMap["1"] = ".----"
	reverseMap["2"] = "..---"
	reverseMap["3"] = "...--"
	reverseMap["4"] = "....-"
	reverseMap["5"] = "....."
	reverseMap["6"] = "-...."
	reverseMap["7"] = "--..."
	reverseMap["8"] = "---.."
	reverseMap["9"] = "----."
	reverseMap["0"] = "-----"

	// Punctuation marks and miscellaneous signs
	reverseMap["."] = ".-.-.-"
	reverseMap[","] = "--..--"
	reverseMap[":"] = "---..."
	reverseMap["?"] = "..--.."
	reverseMap["'"] = ".----."
	reverseMap["-"] = "-....-"
	reverseMap["/"] = "-..-."
	reverseMap["("] = "-.--."
	reverseMap[")"] = "-.--.-"
	reverseMap["+"] = ".-.-."
	reverseMap["×"] = "-..-"
	reverseMap["@"] = ".--.-."

	// buffer holding resultant string
	var result bytes.Buffer

	// no text provided to translate
	if len(args) == 0 {
		errorHandler("Usage: morser -encode PLAINTEXT")
	}

	// iterate over each word of the input text
	for i := 0; i < len(args); i++ {

		// separate word representations in morse code by a backslace
		if i >= 1 {
			result.WriteString(" / ")
		}

		// iterate over each character of the word
		for j := 0; j < len(args[i]); j++ {

			// separate character representations in morse code by a space
			if j >= 1 {
				result.WriteString(" ")
			}

			// validates the input text, character by character
			_, isPresent := reverseMap[strings.ToUpper(string(args[i][j]))]

			// invalid input provided
			if !isPresent {
				errorHandler("Invalid input. Only alphabates, decimals and punctuation marks are supported.")
			}

			result.WriteString(reverseMap[strings.ToUpper(string(args[i][j]))])
		}
	}

	fmt.Println(result.String())
}

func main() {
	// defines a command line flag that looks for encoding permission
	encodeFlag := flag.Bool("encode", false, "morser -encode [arg] : Encodes a plaintext string (argument) to morse code")

	// parse the command line arguments
	flag.Parse()

	// process ahead if the 'encode' flag is available in arguments
	if *encodeFlag {
		translateInput(flag.Args())
	} else {
		errorHandler("Usage: morser -encode PLAINTEXT")
	}
}

A vendor/golang.org/x/crypto/AUTHORS => vendor/golang.org/x/crypto/AUTHORS +3 -0
@@ 0,0 1,3 @@
# This source code refers to The Go Authors for copyright purposes.
# The master list of authors is in the main Go distribution,
# visible at https://tip.golang.org/AUTHORS.

A vendor/golang.org/x/crypto/CONTRIBUTORS => vendor/golang.org/x/crypto/CONTRIBUTORS +3 -0
@@ 0,0 1,3 @@
# This source code was written by the Go contributors.
# The master list of contributors is in the main Go distribution,
# visible at https://tip.golang.org/CONTRIBUTORS.

A vendor/gopkg.in/ini.v1/.gitignore => vendor/gopkg.in/ini.v1/.gitignore +6 -0
@@ 0,0 1,6 @@
testdata/conf_out.ini
ini.sublime-project
ini.sublime-workspace
testdata/conf_reflect.ini
.idea
/.vscode

A vendor/gopkg.in/ini.v1/.travis.yml => vendor/gopkg.in/ini.v1/.travis.yml +15 -0
@@ 0,0 1,15 @@
sudo: false
language: go
go:
  - 1.5.x
  - 1.6.x
  - 1.7.x
  - 1.8.x
  - 1.9.x

script: 
  - go get golang.org/x/tools/cmd/cover
  - go get github.com/smartystreets/goconvey
  - mkdir -p $HOME/gopath/src/gopkg.in
  - ln -s $HOME/gopath/src/github.com/go-ini/ini $HOME/gopath/src/gopkg.in/ini.v1
  - go test -v -cover -race

A vendor/gopkg.in/macaron.v1/.gitignore => vendor/gopkg.in/macaron.v1/.gitignore +3 -0
@@ 0,0 1,3 @@
macaron.sublime-project
macaron.sublime-workspace
.idea

A vendor/gopkg.in/macaron.v1/.travis.yml => vendor/gopkg.in/macaron.v1/.travis.yml +10 -0
@@ 0,0 1,10 @@
sudo: false
language: go
go:
  - 1.5.x
  - 1.6.x
  - 1.7.x
  - 1.8.x
  - 1.9.x

script: go test -v -cover -race

A vendor/modules.txt => vendor/modules.txt +12 -0
@@ 0,0 1,12 @@
# github.com/Unknwon/com v0.0.0-20170819223952-7677a1d7c113
github.com/Unknwon/com
# github.com/go-macaron/inject v0.0.0-20160627170012-d8a0b8677191
github.com/go-macaron/inject
# github.com/go-macaron/session v0.0.0-20170320172209-b8e286a0dba8
github.com/go-macaron/session
# golang.org/x/crypto v0.0.0-20171231215028-0fcca4842a8d
golang.org/x/crypto/pbkdf2
# gopkg.in/ini.v1 v1.32.0
gopkg.in/ini.v1
# gopkg.in/macaron.v1 v1.2.4
gopkg.in/macaron.v1

D vendor/vendor.json => vendor/vendor.json +0 -67
@@ 1,67 0,0 @@
{
	"comment": "",
	"ignore": "test",
	"package": [
		{
			"checksumSHA1": "IrtvVIFBTQmk0+vM7g2xtka5SFg=",
			"path": "github.com/Unknwon/com",
			"revision": "7677a1d7c1137cd3dd5ba7a076d0c898a1ef4520",
			"revisionTime": "2017-08-19T22:39:52Z"
		},
		{
			"checksumSHA1": "y0olVbiMQ6/UOa/eh52XYnies90=",
			"path": "github.com/go-macaron/inject",
			"revision": "d8a0b8677191f4380287cfebd08e462217bac7ad",
			"revisionTime": "2016-06-27T17:00:12Z"
		},
		{
			"checksumSHA1": "gO0dj0NqsmBTkf4D0JzJDtOEx+U=",
			"path": "github.com/go-macaron/session",
			"revision": "b8e286a0dba8f4999042d6b258daf51b31d08938",
			"revisionTime": "2017-03-20T17:22:09Z"
		},
		{
			"checksumSHA1": "Qw5X5yX2VhTMfpqF49dETcxYMdM=",
			"path": "github.com/hellworld-io/morseGo",
			"revision": "ef46ece6471ae7a084ffa376a18ee4129332c756",
			"revisionTime": "2017-04-11T04:35:21Z"
		},
		{
			"checksumSHA1": "ExokTkDbDbNsSUmcKnpUC+3h7V8=",
			"path": "github.com/pravj/morser",
			"revision": "ad33f5cefb7e5c2fb58c7b05958198f5011936d6",
			"revisionTime": "2015-09-15T08:34:09Z"
		},
		{
			"checksumSHA1": "1MGpGDQqnUoRpv7VEcQrXOBydXE=",
			"path": "golang.org/x/crypto/pbkdf2",
			"revision": "0fcca4842a8d74bfddc2c96a073bd2a4d2a7a2e8",
			"revisionTime": "2017-11-25T19:00:56Z"
		},
		{
			"checksumSHA1": "P4LsadWqFYNCs98XRAiacey3q1U=",
			"path": "gopkg.in/ini.v1",
			"revision": "32e4c1e6bc4e7d0d8451aa6b75200d19e37a536a",
			"revisionTime": "2017-11-19T05:34:21Z"
		},
		{
			"checksumSHA1": "VJKlO1AEWQivq2S4DvdmAJU2Fvs=",
			"path": "gopkg.in/macaron.v1",
			"revision": "75f2e9b42e99652f0d82b28ccb73648f44615faa",
			"revisionTime": "2017-11-24T00:20:17Z"
		},
		{
			"path": "morseGo/constants",
			"revision": ""
		},
		{
			"path": "morseGo/flags",
			"revision": ""
		},
		{
			"path": "morseGo/jsons",
			"revision": ""
		}
	],
	"rootPath": "github.com/hmksq/whats-morse"
}