Skip to content
This repository was archived by the owner on Dec 18, 2020. It is now read-only.

Commit 769a42b

Browse files
committed
documentation/urls: fix broken url, adjust urls to new documentation url, make all urls and addresses constant
1 parent 9a9ee48 commit 769a42b

File tree

6 files changed

+25
-15
lines changed

6 files changed

+25
-15
lines changed

error_handler.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
"runtime/debug"
1313
)
1414

15+
const errorsEndpoint = "https://phraseapp.com/errors"
16+
1517
type AppCrash struct {
1618
App string `json:"app"`
1719
AppVersion string `json:"app_version"`
@@ -50,7 +52,7 @@ func ReportError(name string, r interface{}, cfg *phraseapp.Config) {
5052
if err != nil {
5153
return
5254
}
53-
response, err := http.Post("https://phraseapp.com/errors", "application/json", bytes.NewBuffer(body))
55+
response, err := http.Post(errorsEndpoint, "application/json", bytes.NewBuffer(body))
5456

5557
if err != nil {
5658
return

main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ func main() {
1313
Run()
1414
}
1515

16+
const phraseAppSupport = "support@phraseapp.com"
17+
1618
func Run() {
1719
var cfg *phraseapp.Config
1820
defer func() {
1921
if recovery := recover(); recovery != nil {
2022
if PHRASEAPP_CLIENT_VERSION != "DEV" {
2123
ReportError("PhraseApp Client Error", recovery, cfg)
2224
}
23-
printErr(fmt.Errorf("This should not have happened: %s - Contact support: support@phraseapp.com", recovery))
25+
printErr(fmt.Errorf("This should not have happened: %s - Contact support: %s", recovery, phraseAppSupport))
2426
os.Exit(1)
2527
}
2628
}()

pull.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ func (target *Target) CheckPreconditions() error {
9292

9393
if strings.Count(target.File, "*") > 0 {
9494
return fmt.Errorf(
95-
"File pattern for 'pull' cannot include any 'stars' *. Please specify direct and valid paths with file name!\n" +
96-
"http://docs.phraseapp.com/developers/cli/configuration/#targets",
95+
"File pattern for 'pull' cannot include any 'stars' *. Please specify direct and valid paths with file name!\n %s#targets", docsConfigUrl,
9796
)
9897
}
9998

@@ -113,7 +112,6 @@ func (target *Target) CheckPreconditions() error {
113112
}
114113

115114
func (target *Target) Pull(client *phraseapp.Client) error {
116-
117115
if err := target.CheckPreconditions(); err != nil {
118116
return err
119117
}

shared.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,17 @@ type LocaleFile struct {
2020

2121
var placeholderRegexp = regexp.MustCompile("<(locale_name|tag|locale_code)>")
2222

23+
const docsBaseUrl = "https://phraseapp.com/docs"
24+
const docsConfigUrl = docsBaseUrl + "/developers/cli/configuration"
25+
26+
func docsFormatsUrl(formatName string) string {
27+
return fmt.Sprintf("%s/guides/formats/%s", docsBaseUrl, formatName)
28+
}
29+
2330
func ValidPath(file, formatName, formatExtension string) error {
2431
if strings.TrimSpace(file) == "" {
2532
return fmt.Errorf(
26-
"File patterns may not be empty!\nFor more information see http://docs.phraseapp.com/developers/cli/configuration/",
33+
"File patterns may not be empty!\nFor more information see %s", docsConfigUrl,
2734
)
2835
}
2936

@@ -39,8 +46,8 @@ func ValidPath(file, formatName, formatExtension string) error {
3946

4047
if formatExtension != "" && formatExtension != fileExtension {
4148
return fmt.Errorf(
42-
"File extension %q does not equal %q (format: %q) for file %q.\nFor more information see http://docs.phraseapp.com/guides/formats/%s",
43-
fileExtension, formatExtension, formatName, file, formatName,
49+
"File extension %q does not equal %q (format: %q) for file %q.\nFor more information see %s",
50+
fileExtension, formatExtension, formatName, file, docsFormatsUrl(formatName),
4451
)
4552
}
4653

version_check.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import (
1111
"github.com/phrase/phraseapp-client/Godeps/_workspace/src/github.com/dynport/dgtk/version"
1212
)
1313

14+
const cliLandingPageUrl = "https://phraseapp.com/en/cli"
15+
16+
var releaseURL = "https://github.com/phrase/phraseapp-client/releases/latest"
17+
1418
var PHRASEAPP_VERSION_TMP_FILE = "/tmp/.phraseapp.version"
1519

1620
func ValidateVersion() {
@@ -33,13 +37,11 @@ func validateVersionWithErr() error {
3337
return err
3438
}
3539
if clientVersion.Less(currentVersion) {
36-
return fmt.Errorf("Please consider updating the PhraseApp CLI client (%s < %s)\nSee https://phraseapp.com/en/cli", PHRASEAPP_CLIENT_VERSION, currentVersion)
40+
return fmt.Errorf("Please consider updating the PhraseApp CLI client (%s < %s)\nSee %s", PHRASEAPP_CLIENT_VERSION, currentVersion, cliLandingPageUrl)
3741
}
3842
return nil
3943
}
4044

41-
var releaseURL = "https://github.com/phrase/phraseapp-client/releases/latest"
42-
4345
func getLatestReleaseVersion() (string, error) {
4446
req, err := http.NewRequest("HEAD", releaseURL, nil)
4547
if err != nil {

wizard.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"github.com/phrase/phraseapp-client/Godeps/_workspace/src/github.com/phrase/phraseapp-go/phraseapp"
2020
)
2121

22-
const docsURL = "http://docs.phraseapp.com/developers/cli/configuration"
2322
const parrot = `
2423
ppe############eep
2524
p############################pp
@@ -265,7 +264,7 @@ func pushConfig(data *WizardData) error {
265264
}
266265

267266
fmt.Println("Enter the path to your local language files, you want to upload to PhraseApp.")
268-
fmt.Println("For documentation see http://docs.phraseapp.com/developers/cli/configuration/#sources")
267+
fmt.Printf("For documentation see %s#push", docsConfigUrl)
269268

270269
var pushPath string
271270
for {
@@ -295,7 +294,7 @@ func pullConfig(data *WizardData) error {
295294
}
296295

297296
fmt.Println("Enter the path to where you want to store downloaded language files from PhraseApp.")
298-
fmt.Println("For documentation see http://docs.phraseapp.com/developers/cli/configuration/#targets")
297+
fmt.Printf("For documentation see %s#pull", docsConfigUrl)
299298

300299
var pullPath string
301300
for {
@@ -382,7 +381,7 @@ func writeConfig(data *WizardData, filename string) error {
382381
fmt.Println("")
383382
fmt.Println(string(bytes))
384383

385-
printSuccess("You can make changes to this file, see this documentation for more advanced options: " + docsURL)
384+
printSuccess("You can make changes to this file, see this documentation for more advanced options: " + docsConfigUrl)
386385
printSuccess("Now start using phraseapp push & pull for your workflow:")
387386
fmt.Println("")
388387
fmt.Println("$ phraseapp push")

0 commit comments

Comments
 (0)