@@ -20,10 +20,12 @@ type ListOptions struct {
2020 Limit int
2121 Owner string
2222
23- Visibility string
24- Fork bool
25- Source bool
26- Language string
23+ Visibility string
24+ Fork bool
25+ Source bool
26+ Language string
27+ Archived bool
28+ NonArchived bool
2729
2830 Now func () time.Time
2931}
@@ -55,6 +57,9 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
5557 if opts .Source && opts .Fork {
5658 return & cmdutil.FlagError {Err : fmt .Errorf ("specify only one of `--source` or `--fork`" )}
5759 }
60+ if opts .Archived && opts .NonArchived {
61+ return & cmdutil.FlagError {Err : fmt .Errorf ("specify only one of `--archived` or `--no-archived`" )}
62+ }
5863
5964 if flagPrivate {
6065 opts .Visibility = "private"
@@ -79,6 +84,8 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
7984 cmd .Flags ().BoolVar (& opts .Source , "source" , false , "Show only non-forks" )
8085 cmd .Flags ().BoolVar (& opts .Fork , "fork" , false , "Show only forks" )
8186 cmd .Flags ().StringVarP (& opts .Language , "language" , "l" , "" , "Filter by primary coding language" )
87+ cmd .Flags ().BoolVar (& opts .Archived , "archived" , false , "Show only archived repositories" )
88+ cmd .Flags ().BoolVar (& opts .NonArchived , "no-archived" , false , "Omit archived repositories" )
8289
8390 return cmd
8491}
@@ -90,10 +97,12 @@ func listRun(opts *ListOptions) error {
9097 }
9198
9299 filter := FilterOptions {
93- Visibility : opts .Visibility ,
94- Fork : opts .Fork ,
95- Source : opts .Source ,
96- Language : opts .Language ,
100+ Visibility : opts .Visibility ,
101+ Fork : opts .Fork ,
102+ Source : opts .Source ,
103+ Language : opts .Language ,
104+ Archived : opts .Archived ,
105+ NonArchived : opts .NonArchived ,
97106 }
98107
99108 listResult , err := listRepos (httpClient , ghinstance .OverridableDefault (), opts .Limit , opts .Owner , filter )
@@ -117,13 +126,18 @@ func listRun(opts *ListOptions) error {
117126 infoColor = cs .Yellow
118127 }
119128
129+ t := repo .PushedAt
130+ // if listResult.FromSearch {
131+ // t = repo.UpdatedAt
132+ // }
133+
120134 tp .AddField (repo .NameWithOwner , nil , cs .Bold )
121135 tp .AddField (text .ReplaceExcessiveWhitespace (repo .Description ), nil , nil )
122136 tp .AddField (info , nil , infoColor )
123137 if tp .IsTTY () {
124- tp .AddField (utils .FuzzyAgoAbbr (now , repo . PushedAt ), nil , cs .Gray )
138+ tp .AddField (utils .FuzzyAgoAbbr (now , t ), nil , cs .Gray )
125139 } else {
126- tp .AddField (repo . PushedAt .Format (time .RFC3339 ), nil , nil )
140+ tp .AddField (t .Format (time .RFC3339 ), nil , nil )
127141 }
128142 tp .EndRow ()
129143 }
0 commit comments