Hello community,

here is the log from the commit of package golang-github-exercism-cli for 
openSUSE:Factory checked in at 2017-09-14 21:13:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/golang-github-exercism-cli (Old)
 and      /work/SRC/openSUSE:Factory/.golang-github-exercism-cli.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "golang-github-exercism-cli"

Thu Sep 14 21:13:27 2017 rev:4 rq:484066 version:2.4.0+git20170324.41427fc

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/golang-github-exercism-cli/golang-github-exercism-cli.changes
    2017-03-24 02:15:27.848618248 +0100
+++ 
/work/SRC/openSUSE:Factory/.golang-github-exercism-cli.new/golang-github-exercism-cli.changes
       2017-09-14 21:13:33.468576121 +0200
@@ -1,0 +2,13 @@
+Fri Mar 31 10:57:23 UTC 2017 - [email protected]
+
+- Update to version 2.4.0+git20170324.41427fc:
+  * Add silent argument/option to the configure command to obfuscate output
+  * iteration_test: change variable names to camelCase
+  * api_test: fix assertion order
+  * README.md: add comment about setting up local dev site
+  * Replace Client with Interface
+  * Display WhatNextInstructions from API when provided
+  * Fix minor formatting issue in RELEASE doc
+  * Bump version to v2.4.0
+
+-------------------------------------------------------------------

Old:
----
  cli-2.3.0+git20160807.ca8a22e.tar.xz

New:
----
  cli-2.4.0+git20170324.41427fc.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ golang-github-exercism-cli.spec ++++++
--- /var/tmp/diff_new_pack.7ia3s9/_old  2017-09-14 21:13:34.036496183 +0200
+++ /var/tmp/diff_new_pack.7ia3s9/_new  2017-09-14 21:13:34.040495620 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package golang
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
 %global import_path     %{provider_prefix}
 
 Name:           golang-%{provider}-%{project}-%{repo}
-Version:        2.3.0+git20160807.ca8a22e
+Version:        2.4.0+git20170324.41427fc
 Release:        0
 Summary:        A Go based command line tool for exercism.io
 License:        MIT

++++++ _service ++++++
--- /var/tmp/diff_new_pack.7ia3s9/_old  2017-09-14 21:13:34.076490554 +0200
+++ /var/tmp/diff_new_pack.7ia3s9/_new  2017-09-14 21:13:34.076490554 +0200
@@ -3,8 +3,8 @@
     <param name="url">https://github.com/exercism/cli</param>
     <param name="scm">git</param>
     <param name="exclude">.git</param>
-    <param name="versionformat">2.3.0+git%cd.%h</param>
-    <param name="revision">v2.3.0</param>
+    <param name="versionformat">2.4.0+git%cd.%h</param>
+    <param name="revision">v2.4.0</param>
     <param name="changesgenerate">enable</param>
   </service>
   <service name="recompress" mode="disabled">

++++++ cli-2.3.0+git20160807.ca8a22e.tar.xz -> 
cli-2.4.0+git20170324.41427fc.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/.travis.yml 
new/cli-2.4.0+git20170324.41427fc/.travis.yml
--- old/cli-2.3.0+git20160807.ca8a22e/.travis.yml       2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/.travis.yml       2017-03-25 
05:28:37.000000000 +0100
@@ -4,6 +4,7 @@
 
 go:
   - 1.6
+  - 1.7
   - tip
 
 install: true
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/CHANGELOG.md 
new/cli-2.4.0+git20170324.41427fc/CHANGELOG.md
--- old/cli-2.3.0+git20160807.ca8a22e/CHANGELOG.md      2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/CHANGELOG.md      2017-03-25 
05:28:37.000000000 +0100
@@ -7,6 +7,19 @@
 ## Next Release
 * **Your contribution here**
 
+## v2.4.0 (2017-03-24)
+
+* [#344](https://github.com/exercism/cli/pull/344) Make the CLI config paths 
more XDG friendly - [@narqo]
+* [#346](https://github.com/exercism/cli/pull/346) Fallback to UTF-8 if 
encoding is uncertain - [@petertseng]
+* [#350](https://github.com/exercism/cli/pull/350) Add ARMv8 binaries to CLI 
releases - [@Tonkpils]
+* [#352](https://github.com/exercism/cli/pull/352) Fix case sensitivity on 
slug and track ID - [@Tonkpils]
+* [#353](https://github.com/exercism/cli/pull/353) Print confirmation when 
fetching --all - [@neslom]
+* [#356](https://github.com/exercism/cli/pull/356) Resolve symlinks before 
attempting to read files - [@lcowell]
+* [#358](https://github.com/exercism/cli/pull/358) Redact API key from debug 
output - [@Tonkpils]
+* [#359](https://github.com/exercism/cli/pull/359) Add short flag `-m` for 
submit comment flag  - [@jgsqware]
+* [#366](https://github.com/exercism/cli/pull/366) Allow obfuscation on 
configure command - [@dmmulroy]
+* [#367](https://github.com/exercism/cli/pull/367) Use supplied confirmation 
text from API on submit - [@nilbus]
+
 ## v2.3.0 (2016-08-07)
 
 * [#339](https://github.com/exercism/cli/pull/339) Don't run status command if 
API key is missing - [@ests]
@@ -327,6 +340,10 @@
 * Implement login and logout
 * Build on Travis
 
+[@Dparker1990]: https://github.com/Dparker1990
+[@LegalizeAdulthood]: https://github.com/LegalizeAdulthood
+[@Tonkpils]: https://github.com/Tonkpils
+[@TrevorBramble]: https://github.com/TrevorBramble
 [@ambroff]: https://github.com/ambroff
 [@andrewsardone]: https://github.com/andrewsardone
 [@anxiousmodernman]: https://github.com/anxiousmodernman
@@ -336,25 +353,27 @@
 [@daveyarwood]: https://github.com/daveyarwood
 [@devonestes]: https://github.com/devonestes
 [@djquan]: https://github.com/djquan
-[@Dparker1990]: https://github.com/Dparker1990
+[@dmmulroy]: https://github.com/dmmulroy
 [@dpritchett]: https://github.com/dpritchett
+[@eToThePiIPower]: https://github.com/eToThePiIPower
 [@ebautistabar]: https://github.com/ebautistabar
 [@elimisteve]: https://github.com/elimisteve
 [@ests]: https://github.com/ests
-[@eToThePiIPower]: https://github.com/eToThePiIPower
 [@harimp]: https://github.com/harimp
 [@hjljo]: https://github.com/hjljo
 [@isbadawi]: https://github.com/isbadawi
+[@jgsqware]: https://github.com/jgsqware
 [@jish]: https://github.com/jish
 [@jppunnett]: https://github.com/jppunnett
 [@kytrinyx]: https://github.com/kytrinyx
 [@lcowell]: https://github.com/lcowell
-[@LegalizeAdulthood]: https://github.com/LegalizeAdulthood
 [@manusajith]: https://github.com/manusajith
 [@morphatic]: https://github.com/morphatic
 [@msgehard]: https://github.com/msgehard
+[@narqo]: https://github.com/narqo
 [@neslom]: https://github.com/neslom
 [@nf]: https://github.com/nf
+[@nilbus]: https://github.com/nilbus
 [@petertseng]: https://github.com/petertseng
 [@pminten]: https://github.com/pminten
 [@queuebit]: https://github.com/queuebit
@@ -362,6 +381,4 @@
 [@rprouse]: https://github.com/rprouse
 [@simonjefford]: https://github.com/simonjefford
 [@srt32]: https://github.com/srt32
-[@Tonkpils]: https://github.com/Tonkpils
-[@TrevorBramble]: https://github.com/TrevorBramble
 [@zabawaba99]: https://github.com/zabawaba99
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/README.md 
new/cli-2.4.0+git20170324.41427fc/README.md
--- old/cli-2.3.0+git20160807.ca8a22e/README.md 2016-08-08 03:20:29.000000000 
+0200
+++ new/cli-2.4.0+git20170324.41427fc/README.md 2017-03-25 05:28:37.000000000 
+0100
@@ -1,10 +1,9 @@
-[![Build 
Status](https://travis-ci.org/exercism/cli.png?branch=master)](https://travis-ci.org/exercism/cli)
-[![Supporting 24 Pull 
Requests](https://img.shields.io/badge/Supporting-24%20Pull%20Requests-red.svg?style=flat)](http://24pullrequests.com)
+# Exercism Command-line Interface
 
-# Exercism Command-Line Client
+[![Build 
Status](https://travis-ci.org/exercism/cli.svg?branch=master)](https://travis-ci.org/exercism/cli)
+[![Supporting 24 Pull 
Requests](https://img.shields.io/badge/Supporting-24%20Pull%20Requests-red.svg)](http://24pullrequests.com)
 
-The CLI provides a way to do the problems on
-[exercism.io](http://exercism.io).
+The CLI provides a way to do the problems on [exercism.io](http://exercism.io).
 
 **Important**: If you're looking for instructions on how to install the CLI. 
Please read [Installing the CLI](http://exercism.io/cli)
 
@@ -37,6 +36,15 @@
 At the moment the CLI commands are not tested, so if you're adding a new
 command don't worry too hard about tests.
 
+## Testing against exercism.io
+
+If you want to test a change by using your own fork to try `exercism` commands,
+such as `exercism fetch` or `exercism submit`, against the exercism.io site, it
+is advisable that you set up and run a [local development 
environment](https://github.com/exercism/exercism.io/blob/master/docs/setting-up-local-development.md),
+and configure the CLI to submit to your local machine, which would let you
+easily delete and recreate submissions, without fear of breaking the 
exercism.io
+site.
+
 ## Building
 
 To build the binary for your platform run
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/RELEASE.md 
new/cli-2.4.0+git20170324.41427fc/RELEASE.md
--- old/cli-2.3.0+git20160807.ca8a22e/RELEASE.md        2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/RELEASE.md        2017-03-25 
05:28:37.000000000 +0100
@@ -33,7 +33,7 @@
 
 The "next release" section should contain only "Your contribution here".
 
-_Note: It's useful to add the version to the commit message when you bump it: 
e.g. `Bump version to v2.3.4`.
+_Note: It's useful to add the version to the commit message when you bump it: 
e.g. `Bump version to v2.3.4`._
 
 ## Generate the Binaries
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/api/api_test.go 
new/cli-2.4.0+git20170324.41427fc/api/api_test.go
--- old/cli-2.3.0+git20160807.ca8a22e/api/api_test.go   2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/api/api_test.go   2017-03-25 
05:28:37.000000000 +0100
@@ -41,7 +41,7 @@
        problems, err := client.Fetch([]string{})
        assert.NoError(t, err)
 
-       assert.Equal(t, len(problems), 3)
+       assert.Equal(t, 3, len(problems))
 }
 
 func TestFetchATrack(t *testing.T) {
@@ -92,9 +92,9 @@
        all, err := client.FetchAll(trackID)
 
        assert.NoError(t, err)
-       assert.Equal(t, len(all), 3)
-       assert.Equal(t, fetchedList, true)
-       assert.Equal(t, fetchCount, 3)
+       assert.Equal(t, 3, len(all))
+       assert.Equal(t, true, fetchedList)
+       assert.Equal(t, 3, fetchCount)
 }
 
 func TestFetchASpecificProblem(t *testing.T) {
@@ -210,7 +210,7 @@
        sub, err := client.Submit(iter)
        assert.NoError(t, err)
 
-       assert.Equal(t, sub.Language, "ruby")
+       assert.Equal(t, "ruby", sub.Language)
 
        // Test sending comment
        iter.Comment = submissionComment
@@ -234,8 +234,8 @@
        problems, err := client.List("clojure")
        assert.NoError(t, err)
 
-       assert.Equal(t, len(problems), 34)
-       assert.Equal(t, problems[0], "bob")
+       assert.Equal(t, 34, len(problems))
+       assert.Equal(t, "bob", problems[0])
 }
 
 func TestListUnknownTrack(t *testing.T) {
@@ -247,7 +247,7 @@
        client := NewClient(&config.Config{XAPI: ts.URL})
 
        _, err := client.List("rubbbby")
-       assert.Equal(t, err, ErrUnknownTrack)
+       assert.Equal(t, ErrUnknownTrack, err)
 }
 
 func TestStatusUnknownTrack(t *testing.T) {
@@ -259,5 +259,5 @@
        client := NewClient(&config.Config{API: ts.URL})
 
        _, err := client.Status("rubbbby")
-       assert.Equal(t, err, ErrUnknownTrack)
+       assert.Equal(t, ErrUnknownTrack, err)
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/api/iteration.go 
new/cli-2.4.0+git20170324.41427fc/api/iteration.go
--- old/cli-2.3.0+git20160807.ca8a22e/api/iteration.go  2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/api/iteration.go  2017-03-25 
05:28:37.000000000 +0100
@@ -74,7 +74,7 @@
 
 // NewIteration prepares an iteration of a problem in a track for submission 
to the API.
 // It takes a dir (from the global config) and a list of files which it will 
read from disk.
-// All paths are assumed to be absolute paths with symlinks resolved.
+// Paths can point to regular files or to symlinks.
 func NewIteration(dir string, filenames []string) (*Iteration, error) {
        if len(filenames) == 0 {
                return nil, errNoFiles
@@ -102,8 +102,8 @@
                // is still bad. Has the user modified their path in some way?
                return nil, newIterationError(msgGenericPathError, iter.Dir)
        }
-       iter.TrackID = segments[1]
-       iter.Problem = segments[2]
+       iter.TrackID = strings.ToLower(segments[1])
+       iter.Problem = strings.ToLower(segments[2])
 
        for _, filename := range filenames {
                fileContents, err := readFileAsUTF8String(filename)
@@ -137,7 +137,16 @@
                return nil, err
        }
 
-       encoding, _, _ := charset.DetermineEncoding(b, mimeType)
+       encoding, _, certain := charset.DetermineEncoding(b, mimeType)
+       if !certain {
+               // We don't want to use an uncertain encoding.
+               // In particular, doing that may mangle UTF-8 files
+               // that have only ASCII in their first 1024 bytes.
+               // See https://github.com/exercism/cli/issues/309.
+               // So if we're unsure, use UTF-8 (no transformation).
+               s := string(b)
+               return &s, nil
+       }
        decoder := encoding.NewDecoder()
        decodedBytes, _, err := transform.Bytes(decoder, b)
        if err != nil {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/cli-2.3.0+git20160807.ca8a22e/api/iteration_darwin_test.go 
new/cli-2.4.0+git20170324.41427fc/api/iteration_darwin_test.go
--- old/cli-2.3.0+git20160807.ca8a22e/api/iteration_darwin_test.go      
1970-01-01 01:00:00.000000000 +0100
+++ new/cli-2.4.0+git20170324.41427fc/api/iteration_darwin_test.go      
2017-03-25 05:28:37.000000000 +0100
@@ -0,0 +1,38 @@
+package api
+
+import (
+       "path/filepath"
+       "runtime"
+       "testing"
+)
+
+func TestNewIteration_CaseSensitive(t *testing.T) {
+       _, path, _, _ := runtime.Caller(0)
+       dir := filepath.Join(path, "..", "..", "fixtures", "iteration")
+
+       testCases := []map[string][]string{
+               {
+                       "file": []string{filepath.Join(dir, "python", "leap", 
"one.py")},
+               },
+               {
+                       "file": []string{filepath.Join(dir, "Python", "leap", 
"one.py")},
+               },
+               {
+                       "file": []string{filepath.Join(dir, "Python", "Leap", 
"one.py")},
+               },
+       }
+
+       for _, testCase := range testCases {
+               iter, err := NewIteration(dir, testCase["file"])
+               if err != nil {
+                       t.Fatal(err)
+               }
+
+               if iter.TrackID != "python" {
+                       t.Errorf("Expected language to be python, was %s", 
iter.TrackID)
+               }
+               if iter.Problem != "leap" {
+                       t.Errorf("Expected problem to be leap, was %s", 
iter.Problem)
+               }
+       }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/api/iteration_test.go 
new/cli-2.4.0+git20170324.41427fc/api/iteration_test.go
--- old/cli-2.3.0+git20160807.ca8a22e/api/iteration_test.go     2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/api/iteration_test.go     2017-03-25 
05:28:37.000000000 +0100
@@ -8,6 +8,32 @@
        "unicode/utf8"
 )
 
+func TestFollowSymlink(t *testing.T) {
+       _, path, _, _ := runtime.Caller(0)
+       dir := filepath.Join(path, "..", "..", "fixtures", "iteration")
+
+       files := []string{
+               filepath.Join(dir, "python", "leap", "symlink.py"),
+       }
+
+       iter, err := NewIteration(dir, files)
+       if err != nil {
+               t.Fatal(err)
+       }
+
+       for name, contents := range iter.Solution {
+               expectedContents := "# two\n"
+               expectedName := "symlink.py"
+
+               if expectedContents != contents {
+                       t.Errorf("Expected contents to be %s, but got %s", 
expectedContents, contents)
+               }
+               if name != expectedName {
+                       t.Errorf("bad name. expected: %s, got %s", 
expectedName, name)
+               }
+       }
+}
+
 func TestNewIteration(t *testing.T) {
        _, path, _, _ := runtime.Caller(0)
        dir := filepath.Join(path, "..", "..", "fixtures", "iteration")
@@ -18,6 +44,7 @@
                filepath.Join(dir, "python", "leap", "lib", "three.py"),
                filepath.Join(dir, "python", "leap", "utf16le.py"),
                filepath.Join(dir, "python", "leap", "utf16be.py"),
+               filepath.Join(dir, "python", "leap", "long-utf8.py"),
        }
 
        iter, err := NewIteration(dir, files)
@@ -32,16 +59,20 @@
                t.Errorf("Expected problem to be leap, was %s", iter.Problem)
        }
 
-       if len(iter.Solution) != 5 {
-               t.Fatalf("Expected solution to have 3 files, had %d", 
len(iter.Solution))
+       if len(iter.Solution) != 6 {
+               t.Fatalf("Expected solution to have 6 files, had %d", 
len(iter.Solution))
        }
 
-       expected := map[string]string{
-               "one.py": "# one",
-               "two.py": "# two",
-               filepath.Join("lib", "three.py"): "# three",
-               "utf16le.py":                     "# utf16le",
-               "utf16be.py":                     "# utf16be",
+       expected := map[string]struct {
+               prefix string
+               suffix string
+       }{
+               "one.py": {prefix: "# one"},
+               "two.py": {prefix: "# two"},
+               filepath.Join("lib", "three.py"): {prefix: "# three"},
+               "utf16le.py":                     {prefix: "# utf16le"},
+               "utf16be.py":                     {prefix: "# utf16be"},
+               "long-utf8.py":                   {prefix: "# The first 1024", 
suffix: "👍\n"},
        }
 
        for filename, code := range expected {
@@ -49,8 +80,11 @@
                        t.Errorf("Iteration content is not valid UTF-8 data: 
%s", iter.Solution[filename])
                }
 
-               if !strings.HasPrefix(iter.Solution[filename], code) {
-                       t.Errorf("Expected %s to contain `%s', had `%s'", 
filename, code, iter.Solution[filename])
+               if !strings.HasPrefix(iter.Solution[filename], code.prefix) {
+                       t.Errorf("Expected %s to start with `%s', had `%s'", 
filename, code.prefix, iter.Solution[filename])
+               }
+               if !strings.HasSuffix(iter.Solution[filename], code.suffix) {
+                       t.Errorf("Expected %s to end with `%s', had `%s'", 
filename, code.suffix, iter.Solution[filename])
                }
        }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/api/submission.go 
new/cli-2.4.0+git20170324.41427fc/api/submission.go
--- old/cli-2.3.0+git20160807.ca8a22e/api/submission.go 2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/api/submission.go 2017-03-25 
05:28:37.000000000 +0100
@@ -2,13 +2,14 @@
 
 // Submission is an iteration that has been submitted to the API.
 type Submission struct {
-       URL           string            `json:"url"`
-       TrackID       string            `json:"track_id"`
-       Language      string            `json:"language"`
-       Slug          string            `json:"slug"`
-       Name          string            `json:"name"`
-       Username      string            `json:"username"`
-       ProblemFiles  map[string]string `json:"problem_files"`
-       SolutionFiles map[string]string `json:"solution_files"`
-       Iteration     int               `json:"iteration"`
+       URL                  string            `json:"url"`
+       TrackID              string            `json:"track_id"`
+       Language             string            `json:"language"`
+       Slug                 string            `json:"slug"`
+       Name                 string            `json:"name"`
+       Username             string            `json:"username"`
+       WhatNextInstructions string            `json:"what_next_instructions"`
+       ProblemFiles         map[string]string `json:"problem_files"`
+       SolutionFiles        map[string]string `json:"solution_files"`
+       Iteration            int               `json:"iteration"`
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/bin/build-all 
new/cli-2.4.0+git20170324.41427fc/bin/build-all
--- old/cli-2.3.0+git20160807.ca8a22e/bin/build-all     2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/bin/build-all     2017-03-25 
05:28:37.000000000 +0100
@@ -33,6 +33,10 @@
        then
                osarch=arm-v$arm
                ldflags="$ldflags -X $ARMVAR=$arm"
+       elif [ "$arch" = arm64 ]
+       then
+               osarch=arm-v8
+               ldflags="$ldflags -X $ARMVAR=8"
        fi
 
        binname=exercism
@@ -74,6 +78,7 @@
 createRelease linux arm 5
 createRelease linux arm 6
 createRelease linux arm 7
+createRelease linux arm64
 
 # Windows Releases
 createRelease windows 386
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/cmd/configure.go 
new/cli-2.4.0+git20170324.41427fc/cmd/configure.go
--- old/cli-2.3.0+git20160807.ca8a22e/cmd/configure.go  2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/cmd/configure.go  2017-03-25 
05:28:37.000000000 +0100
@@ -5,8 +5,8 @@
        "log"
        "os"
 
-       "github.com/urfave/cli"
        "github.com/exercism/cli/config"
+       "github.com/urfave/cli"
 )
 
 // Configure stores settings in a JSON file.
@@ -22,6 +22,7 @@
        host := ctx.String("host")
        dir := ctx.String("dir")
        api := ctx.String("api")
+       silent := ctx.Bool("silent")
 
        if err := c.Update(key, host, dir, api); err != nil {
                log.Fatalf("Error updating your configuration %s\n", err)
@@ -35,11 +36,13 @@
                log.Fatal(err)
        }
 
-       fmt.Printf("\nConfiguration written to %s\n\n", c.File)
-       fmt.Printf("  --key=%s\n", c.APIKey)
-       fmt.Printf("  --dir=%s\n", c.Dir)
-       fmt.Printf("  --host=%s\n", c.API)
-       fmt.Printf("  --api=%s\n\n", c.XAPI)
+       if !silent {
+               fmt.Printf("\nConfiguration written to %s\n\n", c.File)
+               fmt.Printf("  --key=%s\n", c.APIKey)
+               fmt.Printf("  --dir=%s\n", c.Dir)
+               fmt.Printf("  --host=%s\n", c.API)
+               fmt.Printf("  --api=%s\n\n", c.XAPI)
+       }
 
        return nil
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/cmd/debug.go 
new/cli-2.4.0+git20170324.41427fc/cmd/debug.go
--- old/cli-2.3.0+git20160807.ca8a22e/cmd/debug.go      2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/cmd/debug.go      2017-03-25 
05:28:37.000000000 +0100
@@ -6,12 +6,13 @@
        "net/http"
        "os"
        "runtime"
+       "strings"
        "sync"
        "time"
 
-       "github.com/urfave/cli"
        "github.com/exercism/cli/config"
        "github.com/exercism/cli/paths"
+       "github.com/urfave/cli"
 )
 
 type pingResult struct {
@@ -53,27 +54,9 @@
                log.Fatal(err)
        }
 
-       configured := true
-       if _, err = os.Stat(c.File); err != nil {
-               if os.IsNotExist(err) {
-                       configured = false
-               } else {
-                       log.Fatal(err)
-               }
-       }
-
-       if configured {
-               fmt.Printf("Config file: %s\n", c.File)
-               if c.APIKey != "" {
-                       fmt.Printf("API Key: %s\n", c.APIKey)
-               } else {
-                       fmt.Println("API Key: Please set your API Key to access 
all of the CLI features")
-               }
-       } else {
-               fmt.Println("Config file: <not configured>")
-               fmt.Println("API Key: Please set your API Key to access all of 
the CLI features")
+       if err := printConfigFileData(ctx, c); err != nil {
+               log.Fatal(err)
        }
-       fmt.Printf("Exercises Directory: %s\n", c.Dir)
 
        fmt.Println("Testing API endpoints reachability")
 
@@ -131,3 +114,40 @@
 
        return nil
 }
+
+func printConfigFileData(ctx *cli.Context, cfg *config.Config) error {
+       configured := true
+       if _, err := os.Stat(cfg.File); err != nil {
+               if os.IsNotExist(err) {
+                       configured = false
+               } else {
+                       return err
+               }
+       }
+
+       apiKey := "Please set your API key to access all of the CLI features"
+       configFile := fmt.Sprintf("%s (not configured)", cfg.File)
+
+       if configured {
+               configFile = cfg.File
+               if cfg.APIKey != "" {
+                       if ctx.Bool("full-api-key") {
+                               apiKey = cfg.APIKey
+                       } else {
+                               apiKey = redactAPIKey(cfg.APIKey)
+                       }
+               }
+       }
+
+       fmt.Printf("Config File: %s\n", configFile)
+       fmt.Printf("API Key: %s\n", apiKey)
+       fmt.Printf("Exercises Directory: %s\n", cfg.Dir)
+
+       return nil
+}
+
+func redactAPIKey(apiKey string) string {
+       str := apiKey[4 : len(apiKey)-3]
+       redaction := strings.Repeat("*", len(str))
+       return string(apiKey[:4]) + redaction + string(apiKey[len(apiKey)-3:])
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/cmd/download.go 
new/cli-2.4.0+git20170324.41427fc/cmd/download.go
--- old/cli-2.3.0+git20160807.ca8a22e/cmd/download.go   2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/cmd/download.go   2017-03-25 
05:28:37.000000000 +0100
@@ -8,9 +8,9 @@
        "path/filepath"
        "strings"
 
-       "github.com/urfave/cli"
        "github.com/exercism/cli/api"
        "github.com/exercism/cli/config"
+       "github.com/urfave/cli"
 )
 
 // Download returns specified iteration with its related problem.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/cmd/fetch.go 
new/cli-2.4.0+git20170324.41427fc/cmd/fetch.go
--- old/cli-2.3.0+git20160807.ca8a22e/cmd/fetch.go      2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/cmd/fetch.go      2017-03-25 
05:28:37.000000000 +0100
@@ -1,13 +1,14 @@
 package cmd
 
 import (
+       "fmt"
        "log"
        "path/filepath"
 
-       "github.com/urfave/cli"
        "github.com/exercism/cli/api"
        "github.com/exercism/cli/config"
        "github.com/exercism/cli/user"
+       "github.com/urfave/cli"
 )
 
 // Fetch downloads exercism problems and writes them to disk.
@@ -24,6 +25,7 @@
        if ctx.Bool("all") {
                if len(args) > 0 {
                        trackID := args[0]
+                       fmt.Printf("\nFetching all problems for the %s 
track...\n\n", trackID)
                        p, err := client.FetchAll(trackID)
                        if err != nil {
                                log.Fatal(err)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/cmd/list.go 
new/cli-2.4.0+git20170324.41427fc/cmd/list.go
--- old/cli-2.3.0+git20160807.ca8a22e/cmd/list.go       2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/cmd/list.go       2017-03-25 
05:28:37.000000000 +0100
@@ -5,9 +5,9 @@
        "log"
        "os"
 
-       "github.com/urfave/cli"
        "github.com/exercism/cli/api"
        "github.com/exercism/cli/config"
+       "github.com/urfave/cli"
 )
 
 const msgExplainFetch = "In order to fetch a specific assignment, call the 
fetch command with a specific assignment.\n\nexercism fetch %s %s\n\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/cmd/open.go 
new/cli-2.4.0+git20170324.41427fc/cmd/open.go
--- old/cli-2.3.0+git20160807.ca8a22e/cmd/open.go       2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/cmd/open.go       2017-03-25 
05:28:37.000000000 +0100
@@ -8,9 +8,9 @@
        "runtime"
        "strings"
 
-       "github.com/urfave/cli"
        "github.com/exercism/cli/api"
        "github.com/exercism/cli/config"
+       "github.com/urfave/cli"
 )
 
 // Open uses the given track and problem and opens it in the browser.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/cmd/restore.go 
new/cli-2.4.0+git20170324.41427fc/cmd/restore.go
--- old/cli-2.3.0+git20160807.ca8a22e/cmd/restore.go    2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/cmd/restore.go    2017-03-25 
05:28:37.000000000 +0100
@@ -3,10 +3,10 @@
 import (
        "log"
 
-       "github.com/urfave/cli"
        "github.com/exercism/cli/api"
        "github.com/exercism/cli/config"
        "github.com/exercism/cli/user"
+       "github.com/urfave/cli"
 )
 
 // Restore returns a user's solved problems.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/cmd/skip.go 
new/cli-2.4.0+git20170324.41427fc/cmd/skip.go
--- old/cli-2.3.0+git20160807.ca8a22e/cmd/skip.go       2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/cmd/skip.go       2017-03-25 
05:28:37.000000000 +0100
@@ -5,9 +5,9 @@
        "log"
        "os"
 
-       "github.com/urfave/cli"
        "github.com/exercism/cli/api"
        "github.com/exercism/cli/config"
+       "github.com/urfave/cli"
 )
 
 // Skip allows a user to skip a specific problem.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/cmd/status.go 
new/cli-2.4.0+git20170324.41427fc/cmd/status.go
--- old/cli-2.3.0+git20160807.ca8a22e/cmd/status.go     2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/cmd/status.go     2017-03-25 
05:28:37.000000000 +0100
@@ -5,9 +5,9 @@
        "log"
        "os"
 
-       "github.com/urfave/cli"
        "github.com/exercism/cli/api"
        "github.com/exercism/cli/config"
+       "github.com/urfave/cli"
 )
 
 // Status is a command that allows a user to view their progress in a given
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/cmd/submit.go 
new/cli-2.4.0+git20170324.41427fc/cmd/submit.go
--- old/cli-2.3.0+git20160807.ca8a22e/cmd/submit.go     2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/cmd/submit.go     2017-03-25 
05:28:37.000000000 +0100
@@ -7,10 +7,10 @@
        "os"
        "path/filepath"
 
-       "github.com/urfave/cli"
        "github.com/exercism/cli/api"
        "github.com/exercism/cli/config"
        "github.com/exercism/cli/paths"
+       "github.com/urfave/cli"
 )
 
 // Submit posts an iteration to the API.
@@ -74,22 +74,12 @@
                if ctx.GlobalBool("verbose") {
                        log.Printf("absolute path: %s", file)
                }
-
-               file, err = filepath.EvalSymlinks(file)
-               if err != nil {
-                       log.Fatal(err)
-               }
-
-               if ctx.GlobalBool("verbose") {
-                       log.Printf("eval symlinks (file): %s", file)
-               }
-
                files = append(files, file)
        }
 
        iteration, err := api.NewIteration(dir, files)
        if err != nil {
-               log.Fatalf("Unable to submit - %s", err)
+               log.Fatalf("unable to submit - %s", err)
        }
        iteration.Key = c.APIKey
        iteration.Comment = ctx.String("comment")
@@ -100,10 +90,14 @@
                log.Fatal(err)
        }
 
-       solutionURL, _ := url.Parse(c.API)
-       solutionURL.Path += fmt.Sprintf("tracks/%s/exercises/%s", 
iteration.TrackID, iteration.Problem)
-       fmt.Printf("Your %s solution for %s has been submitted. View it 
here:\n%s\n\n", submission.Language, submission.Name, submission.URL)
-       fmt.Printf("See related solutions and get involved here:\n%s\n\n", 
solutionURL)
+       if len(submission.WhatNextInstructions) > 0 {
+               fmt.Print(submission.WhatNextInstructions)
+       } else {
+               solutionURL, _ := url.Parse(c.API)
+               solutionURL.Path += fmt.Sprintf("tracks/%s/exercises/%s", 
iteration.TrackID, iteration.Problem)
+               fmt.Printf("Your %s solution for %s has been submitted. View it 
here:\n%s\n\n", submission.Language, submission.Name, submission.URL)
+               fmt.Printf("See related solutions and get involved 
here:\n%s\n\n", solutionURL)
+       }
 
        return nil
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/cmd/tracks.go 
new/cli-2.4.0+git20170324.41427fc/cmd/tracks.go
--- old/cli-2.3.0+git20160807.ca8a22e/cmd/tracks.go     2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/cmd/tracks.go     2017-03-25 
05:28:37.000000000 +0100
@@ -4,10 +4,10 @@
        "fmt"
        "log"
 
-       "github.com/urfave/cli"
        "github.com/exercism/cli/api"
        "github.com/exercism/cli/config"
        "github.com/exercism/cli/user"
+       "github.com/urfave/cli"
 )
 
 // Tracks lists available tracks.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/cmd/upgrade.go 
new/cli-2.4.0+git20170324.41427fc/cmd/upgrade.go
--- old/cli-2.3.0+git20160807.ca8a22e/cmd/upgrade.go    2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/cmd/upgrade.go    2017-03-25 
05:28:37.000000000 +0100
@@ -9,8 +9,8 @@
        "strings"
        "time"
 
-       "github.com/urfave/cli"
        "github.com/kardianos/osext"
+       "github.com/urfave/cli"
 )
 
 var (
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/config/config.go 
new/cli-2.4.0+git20170324.41427fc/config/config.go
--- old/cli-2.3.0+git20160807.ca8a22e/config/config.go  2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/config/config.go  2017-03-25 
05:28:37.000000000 +0100
@@ -34,8 +34,20 @@
 
 // New returns a configuration struct with content from the exercism.json file
 func New(path string) (*Config, error) {
-       c := &Config{}
-       err := c.load(paths.Config(path))
+       configPath := paths.Config(path)
+       _, err := os.Stat(configPath)
+       if err != nil && os.IsNotExist(err) {
+               if path == "" {
+                       configPath = paths.DefaultConfig
+               }
+       } else if err != nil {
+               return nil, err
+       }
+
+       c := &Config{
+               File: configPath,
+       }
+       err = c.load()
        return c, err
 }
 
@@ -84,9 +96,7 @@
        return nil
 }
 
-func (c *Config) load(argPath string) error {
-       c.File = argPath
-
+func (c *Config) load() error {
        if err := c.read(); err != nil {
                return err
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/config/config_test.go 
new/cli-2.4.0+git20170324.41427fc/config/config_test.go
--- old/cli-2.3.0+git20160807.ca8a22e/config/config_test.go     2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/config/config_test.go     2017-03-25 
05:28:37.000000000 +0100
@@ -17,15 +17,19 @@
        if err != nil {
                t.Fatal(err)
        }
-       configPath := filepath.Join(tmpDir, "config.json")
+
+       paths.Home = tmpDir
+       paths.ConfigHome = tmpDir
+       paths.DefaultConfig = filepath.Join(tmpDir, "default.json")
+
+       configPath := filepath.Join(paths.ConfigHome, "config.json")
        if err := os.Link(fixturePath(t, "config.json"), configPath); err != 
nil {
                t.Fatal(err)
        }
-       dirtyPath := filepath.Join(tmpDir, "dirty.json")
+       dirtyPath := filepath.Join(paths.ConfigHome, "dirty.json")
        if err := os.Link(fixturePath(t, "dirty.json"), dirtyPath); err != nil {
                t.Fatal(err)
        }
-       paths.Home = tmpDir
 
        testCases := []struct {
                desc                string
@@ -36,7 +40,7 @@
                {
                        desc: "defaults",
                        in:   "",
-                       out:  paths.Config(""),
+                       out:  paths.DefaultConfig,
                        dir:  paths.Exercises(""),
                        key:  "",
                        api:  hostAPI,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/exercism/main.go 
new/cli-2.4.0+git20170324.41427fc/exercism/main.go
--- old/cli-2.3.0+git20160807.ca8a22e/exercism/main.go  2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/exercism/main.go  2017-03-25 
05:28:37.000000000 +0100
@@ -17,7 +17,7 @@
        // We try to follow Semantic Versioning (http://semver.org),
        // but with the http://exercism.io app being a prototype, a
        // lot of things get out of hand.
-       Version = "2.3.0"
+       Version = "2.4.0"
 
        descConfigure = "Writes config values to a JSON file."
        descDebug     = "Outputs useful debug information."
@@ -81,12 +81,22 @@
                                        Name:  "api, a",
                                        Usage: "exercism xapi host",
                                },
+                               cli.BoolFlag{
+                                       Name:  "silent, s",
+                                       Usage: "Obfuscates configuration 
options from output",
+                               },
                        },
                        Action: cmd.Configure,
                },
                {
-                       Name:   "debug",
-                       Usage:  descDebug,
+                       Name:  "debug",
+                       Usage: descDebug,
+                       Flags: []cli.Flag{
+                               cli.BoolFlag{
+                                       Name:  "full-api-key",
+                                       Usage: "Displays the full API key 
without obfuscating it",
+                               },
+                       },
                        Action: cmd.Debug,
                },
                {
@@ -150,7 +160,7 @@
                                        Usage: "allow submission of test files",
                                },
                                cli.StringFlag{
-                                       Name:  "comment",
+                                       Name:  "comment, m",
                                        Usage: "includes a comment with the 
submission",
                                },
                        },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/cli-2.3.0+git20160807.ca8a22e/fixtures/iteration/python/leap/long-utf8.py 
new/cli-2.4.0+git20170324.41427fc/fixtures/iteration/python/leap/long-utf8.py
--- 
old/cli-2.3.0+git20160807.ca8a22e/fixtures/iteration/python/leap/long-utf8.py   
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/cli-2.4.0+git20170324.41427fc/fixtures/iteration/python/leap/long-utf8.py   
    2017-03-25 05:28:37.000000000 +0100
@@ -0,0 +1,31 @@
+# The first 1024 bytes of this file need to contain only ASCII characters.
+# After the first 1024 bytes, then there should be a non-ASCII character.
+#
+# Explanation:
+# We use golang.org/x/net/html/charset.DetectEncoding to guess file encoding.
+# DetectEncoding checks the first 1024 bytes of a file.
+# If it can't determine the encoding and saw no non-ASCII characters,
+# it declares the file to have windows-1252 encoding.
+# This mangles the submitted file if it should have been UTF-8.
+# We test to make sure we use UTF-8 for such files, instead of windows-1252.
+
+lipsum = """
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam condimentum vitae
+ipsum eget tempor. Morbi sed ex quis orci vulputate cursus quis non massa.
+Vestibulum quam nibh, elementum in justo in, venenatis tristique nisl. Morbi
+sagittis elit id velit ultricies, sed rutrum augue posuere. Donec nec nulla nec
+eros fringilla pellentesque. Duis at dictum justo. Nunc ut magna felis. Aliquam
+volutpat, lectus et molestie porttitor, est orci malesuada erat, ac pretium
+eros ligula vel erat. Nullam venenatis dui eget sapien semper lobortis. Aenean
+ac eros eget neque porta auctor in nec erat. Phasellus ac nulla ac turpis
+porttitor auctor. Etiam eget posuere diam, ac feugiat lacus. Curabitur ornare
+justo ut nulla congue, vitae posuere erat venenatis. Aliquam pulvinar eleifend
+faucibus.
+
+Etiam justo sem, faucibus malesuada purus a, ultrices efficitur ex.
+Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac
+turpis egestas. Duis maximus dapibus mattis. Quisque sem ex, convallis eu
+ultricies posuere.
+"""
+
+# 👍
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/cli-2.3.0+git20160807.ca8a22e/fixtures/iteration/python/leap/symlink.py 
new/cli-2.4.0+git20170324.41427fc/fixtures/iteration/python/leap/symlink.py
--- old/cli-2.3.0+git20160807.ca8a22e/fixtures/iteration/python/leap/symlink.py 
1970-01-01 01:00:00.000000000 +0100
+++ new/cli-2.4.0+git20170324.41427fc/fixtures/iteration/python/leap/symlink.py 
2017-09-14 21:13:34.444438763 +0200
@@ -0,0 +1 @@
+symbolic link to two.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/paths/paths.go 
new/cli-2.4.0+git20170324.41427fc/paths/paths.go
--- old/cli-2.3.0+git20160807.ca8a22e/paths/paths.go    2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/paths/paths.go    2017-03-25 
05:28:37.000000000 +0100
@@ -11,7 +11,7 @@
 const (
        // File is the default name of the JSON file where the config written.
        // The user can pass an alternate filename when using the CLI.
-       File = ".exercism.json"
+       File = "exercism.json"
        // DirExercises is the default name of the directory for active users.
        // Make this non-exported when handlers.Login is deleted.
        DirExercises = "exercism"
@@ -20,31 +20,37 @@
 var (
        // Home by default will contact the location of your home directory.
        Home string
+       // ConfigHome will contain $XDG_CONFIG_HOME if it is set or default 
config home directory.
+       ConfigHome string
+       // DefaultConfig will contain default path to config, according to Home
+       DefaultConfig string
 
-       // XDGConfigHome will contain $XDG_CONFIG_HOME if it exists.
-       XDGConfigHome   string
        errHomeNotFound = errors.New("unable to locate home directory")
 )
 
 func init() {
-       // on startup set default values
-       Recalculate()
+       var err error
+       Home, err = findHome()
+       if err != nil {
+               panic(err)
+       }
+       ConfigHome = os.Getenv("XDG_CONFIG_HOME")
+       if ConfigHome == "" {
+               ConfigHome = filepath.Join(Home, ".config")
+       }
+       DefaultConfig = filepath.Join(Home, "."+File)
 }
 
 // Config will return the correct input path given any input.
-// Blank input will return the default configuration location.
+// Blank input will return the default configuration location based
+// on ConfigHome.
 // Non-blank input will expand home to be an absolute path.
 // If the target is known to be a directory, the config filename
 // will be appended.
 func Config(path string) string {
        if path == "" {
-               if XDGConfigHome == "" {
-                       return filepath.Join(Home, File)
-               }
-
-               return filepath.Join(XDGConfigHome, File)
+               return filepath.Join(ConfigHome, File)
        }
-
        expandedPath := expandPath(path)
        if IsDir(path) {
                expandedPath = filepath.Join(expandedPath, File)
@@ -62,18 +68,6 @@
        return expandPath(path)
 }
 
-// Recalculate sets exercism paths based on Home.
-func Recalculate() {
-       if Home == "" {
-               home, err := findHome()
-               if err != nil {
-                       panic(err)
-               }
-               Home = home
-       }
-       XDGConfigHome = os.Getenv("XDG_CONFIG_HOME")
-}
-
 // IsDir determines whether the given path is a valid directory path.
 func IsDir(path string) bool {
        fi, _ := os.Stat(path)
@@ -114,7 +108,7 @@
 }
 
 func expandHome(path string) string {
-       if path[:2] == "~"+string(os.PathSeparator) {
+       if strings.HasPrefix(path, "~"+string(os.PathSeparator)) {
                return strings.Replace(path, "~", Home, 1)
        }
        return path
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cli-2.3.0+git20160807.ca8a22e/paths/paths_test.go 
new/cli-2.4.0+git20170324.41427fc/paths/paths_test.go
--- old/cli-2.3.0+git20160807.ca8a22e/paths/paths_test.go       2016-08-08 
03:20:29.000000000 +0200
+++ new/cli-2.4.0+git20170324.41427fc/paths/paths_test.go       2017-03-25 
05:28:37.000000000 +0100
@@ -12,11 +12,19 @@
        assert.Equal(t, os.Getenv("HOME"), Home)
 }
 
+func TestConfigHome(t *testing.T) {
+       xdgConfigHome := os.Getenv("XDG_CONFIG_HOME")
+       if xdgConfigHome == "" {
+               assert.Equal(t, filepath.Join(Home, ".config"), ConfigHome)
+       } else {
+               assert.Equal(t, xdgConfigHome, ConfigHome)
+       }
+}
+
 func TestExercises(t *testing.T) {
        dir, err := os.Getwd()
        assert.NoError(t, err)
        Home = "/test/home"
-       Recalculate()
 
        testCases := []struct {
                givenPath    string
@@ -40,7 +48,7 @@
        assert.NoError(t, err)
 
        Home = dir
-       Recalculate()
+       ConfigHome = dir
 
        testCases := []struct {
                desc         string
@@ -50,7 +58,7 @@
                {
                        "blank path",
                        "",
-                       filepath.Join(Home, ".exercism.json"),
+                       filepath.Join(ConfigHome, File),
                },
                {
                        "unknown path is expanded, but not modified",
@@ -74,10 +82,3 @@
                assert.Equal(t, tc.expectedPath, actual, tc.desc)
        }
 }
-
-func TestXDGConfig(t *testing.T) {
-       XDGConfigHome = "/home/user/.xdg_config"
-
-       assert.Equal(t, filepath.Join(XDGConfigHome, File), Config(""))
-
-}


Reply via email to