mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
A bit of niceness: more hints for first-time user.
This commit is contained in:
+11
-7
@@ -15,15 +15,19 @@ func aptlyMirrorList(cmd *commander.Command, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("List of mirrors:\n")
|
|
||||||
|
|
||||||
repoCollection := debian.NewRemoteRepoCollection(context.database)
|
repoCollection := debian.NewRemoteRepoCollection(context.database)
|
||||||
repoCollection.ForEach(func(repo *debian.RemoteRepo) error {
|
|
||||||
fmt.Printf(" * %s\n", repo)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
fmt.Printf("\nTo get more information about repository, run `aptly mirror show <name>`.\n")
|
if repoCollection.Len() > 0 {
|
||||||
|
fmt.Printf("List of mirrors:\n")
|
||||||
|
repoCollection.ForEach(func(repo *debian.RemoteRepo) error {
|
||||||
|
fmt.Printf(" * %s\n", repo)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
fmt.Printf("\nTo get more information about repository, run `aptly mirror show <name>`.\n")
|
||||||
|
} else {
|
||||||
|
fmt.Printf("No mirrors found, create one with `aptly mirror create ...`.\n")
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-7
@@ -53,16 +53,21 @@ func aptlySnapshotList(cmd *commander.Command, args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("List of snapshots:\n")
|
|
||||||
|
|
||||||
snapshotCollection := debian.NewSnapshotCollection(context.database)
|
snapshotCollection := debian.NewSnapshotCollection(context.database)
|
||||||
snapshotCollection.ForEach(func(snapshot *debian.Snapshot) error {
|
|
||||||
fmt.Printf(" * %s\n", snapshot)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
fmt.Printf("\nTo get more information about snapshot, run `aptly snapshot show <name>`.\n")
|
if snapshotCollection.Len() > 0 {
|
||||||
|
fmt.Printf("List of snapshots:\n")
|
||||||
|
snapshotCollection.ForEach(func(snapshot *debian.Snapshot) error {
|
||||||
|
fmt.Printf(" * %s\n", snapshot)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
fmt.Printf("\nTo get more information about snapshot, run `aptly snapshot show <name>`.\n")
|
||||||
|
} else {
|
||||||
|
fmt.Printf("\nNo snapshots found, create one with `aptly snapshot create...`.\n")
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func aptlySnapshotShow(cmd *commander.Command, args []string) error {
|
func aptlySnapshotShow(cmd *commander.Command, args []string) error {
|
||||||
|
|||||||
Vendored
+5
@@ -358,3 +358,8 @@ func (collection *RemoteRepoCollection) ForEach(handler func(*RemoteRepo) error)
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Len returns number of remote repos
|
||||||
|
func (collection *RemoteRepoCollection) Len() int {
|
||||||
|
return len(collection.list)
|
||||||
|
}
|
||||||
|
|||||||
Vendored
+3
-1
@@ -219,7 +219,7 @@ func (s *RemoteRepoCollectionSuite) TestUpdateLoadComplete(c *C) {
|
|||||||
c.Assert(r.NumPackages(), Equals, 3)
|
c.Assert(r.NumPackages(), Equals, 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RemoteRepoCollectionSuite) TestForEach(c *C) {
|
func (s *RemoteRepoCollectionSuite) TestForEachAndLen(c *C) {
|
||||||
repo, _ := NewRemoteRepo("yandex", "http://mirror.yandex.ru/debian/", "squeeze", []string{"main"}, []string{})
|
repo, _ := NewRemoteRepo("yandex", "http://mirror.yandex.ru/debian/", "squeeze", []string{"main"}, []string{})
|
||||||
s.collection.Add(repo)
|
s.collection.Add(repo)
|
||||||
|
|
||||||
@@ -231,6 +231,8 @@ func (s *RemoteRepoCollectionSuite) TestForEach(c *C) {
|
|||||||
c.Assert(count, Equals, 1)
|
c.Assert(count, Equals, 1)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
|
c.Check(s.collection.Len(), Equals, 1)
|
||||||
|
|
||||||
e := errors.New("c")
|
e := errors.New("c")
|
||||||
|
|
||||||
err = s.collection.ForEach(func(*RemoteRepo) error {
|
err = s.collection.ForEach(func(*RemoteRepo) error {
|
||||||
|
|||||||
Vendored
+6
@@ -172,3 +172,9 @@ func (collection *SnapshotCollection) ForEach(handler func(*Snapshot) error) err
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Len returns number of snapshots in collection
|
||||||
|
// ForEach runs method for each snapshot
|
||||||
|
func (collection *SnapshotCollection) Len() int {
|
||||||
|
return len(collection.list)
|
||||||
|
}
|
||||||
|
|||||||
Vendored
+3
-1
@@ -112,7 +112,7 @@ func (s *SnapshotCollectionSuite) TestUpdateLoadComplete(c *C) {
|
|||||||
c.Assert(snapshot.NumPackages(), Equals, 3)
|
c.Assert(snapshot.NumPackages(), Equals, 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SnapshotCollectionSuite) TestForEach(c *C) {
|
func (s *SnapshotCollectionSuite) TestForEachAndLen(c *C) {
|
||||||
s.collection.Add(s.snapshot1)
|
s.collection.Add(s.snapshot1)
|
||||||
s.collection.Add(s.snapshot2)
|
s.collection.Add(s.snapshot2)
|
||||||
|
|
||||||
@@ -124,6 +124,8 @@ func (s *SnapshotCollectionSuite) TestForEach(c *C) {
|
|||||||
c.Assert(count, Equals, 2)
|
c.Assert(count, Equals, 2)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
|
c.Check(s.collection.Len(), Equals, 2)
|
||||||
|
|
||||||
e := errors.New("d")
|
e := errors.New("d")
|
||||||
err = s.collection.ForEach(func(*Snapshot) error {
|
err = s.collection.ForEach(func(*Snapshot) error {
|
||||||
return e
|
return e
|
||||||
|
|||||||
Reference in New Issue
Block a user