~chipaca/snappy/snappy-tar-pack-mknod

« back to all changes in this revision

Viewing changes to snappy/commands.go

  • Committer: Sergio Schvezov
  • Date: 2014-12-18 11:43:43 UTC
  • Revision ID: sergio.schvezov@canonical.com-20141218114343-2ira9hk6qx97ar7v
Reordering sources and running "goimports -w ."

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
package snappy
2
2
 
3
3
import (
4
 
        "fmt"
5
 
        "os"
6
 
        "io/ioutil"
7
 
        "os/exec"
8
 
        "gopkg.in/yaml.v2"
9
4
        "archive/tar"
10
5
        "bytes"
11
6
        "compress/gzip"
 
7
        "encoding/json"
12
8
        "errors"
13
 
        "github.com/blakesmith/ar"
 
9
        "fmt"
14
10
        "io"
 
11
        "io/ioutil"
15
12
        "log"
 
13
        "net/http"
 
14
        "os"
 
15
        "os/exec"
16
16
        "strings"
17
 
        "net/http"
18
 
        "encoding/json"
 
17
 
 
18
        "github.com/blakesmith/ar"
19
19
        "github.com/olekukonko/tablewriter"
 
20
        "gopkg.in/yaml.v1"
20
21
)
21
22
 
22
23
const APPS_ROOT = "/apps"
282
283
                return nil
283
284
        }
284
285
        embedded := searchData["_embedded"].(map[string]interface{})
285
 
        packages :=  embedded["clickindex:package"].([]interface{})
 
286
        packages := embedded["clickindex:package"].([]interface{})
286
287
 
287
288
        // FIXME: how to wrap tablewriter.NewWriter() so that we always
288
289
        //        get the no row/col/center sepators?
291
292
        table.SetColumnSeparator("")
292
293
        table.SetCenterSeparator("")
293
294
 
294
 
        for _, raw := range(packages) {
 
295
        for _, raw := range packages {
295
296
                pkg := raw.(map[string]interface{})
296
297
                //fmt.Printf("%s (%s) - %s \n", pkg["name"], pkg["version"], pkg["title"])
297
298
                table.Append([]string{pkg["name"].(string), pkg["version"].(string), pkg["title"].(string)})
298
299
        }
299
300
        table.Render()
300
301
 
301
 
        return nil;
 
302
        return nil
302
303
}
303