mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
refactor: remove features beyond the UX plan
Drop additions that the UX plan does not ask for: - the interactive label edit form; label edit now requires a flag - label clone and the skip mode of label creation it needed - repo rename rewriting the Git remote or tea.repository; it now warns that the remote still points to the old name - the extra "source" remote on clones of pull mirrors - run artifact download, which duplicates run download --zip - 256-color and 24-bit label swatches; colors stay ANSI 16 - config list --show-source (config get keeps it) - the membership and access GETs before team member/repo add and remove; Gitea's PUT and DELETE are idempotent label edit/delete keep --by-name: it is the only way to address a label whose name is a number that is also another label's ID. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
22 files changed
+69
-560
No files matched your search
+10
-21
@@ -107,11 +107,10 @@ func (a *application) effectivePreferences(snapshot settings.Snapshot) (settings
|
||||
return preferences, sources, nil
|
||||
}
|
||||
|
||||
// configSetting is one effective setting and where its value comes from.
|
||||
// configSetting is one effective setting.
|
||||
type configSetting struct {
|
||||
Key string
|
||||
Value any
|
||||
Source string
|
||||
Key string
|
||||
Value any
|
||||
}
|
||||
|
||||
// settingValues returns the effective preferences, the settings of the selected instance when it is
|
||||
@@ -242,45 +241,35 @@ $ tea config get ssh_key --host https://gitea.com --user alice`,
|
||||
}
|
||||
get.Flags().BoolVar(&getSource, "show-source", false, "Also print where the value comes from")
|
||||
group.AddCommand(get)
|
||||
var listSource bool
|
||||
list := &cobra.Command{
|
||||
Use: "list", Short: "List settings and their values", Args: argsExact(0),
|
||||
Example: `$ tea config list
|
||||
# Include the settings of an instance and where each value comes from
|
||||
$ tea config list --host https://gitea.com --show-source`,
|
||||
# Include the settings of an instance
|
||||
$ tea config list --host https://gitea.com`,
|
||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||
snapshot, err := a.deps.Settings.Load()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
values, sources, err := a.settingValues(snapshot)
|
||||
values, _, err := a.settingValues(snapshot)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if a.options.json != "" {
|
||||
return a.writeSettingsJSON(cmd, values, sources, listSource)
|
||||
return a.writeJSON(cmd, values)
|
||||
}
|
||||
items := make([]configSetting, 0, len(values))
|
||||
for _, key := range slices.Sorted(maps.Keys(values)) {
|
||||
items = append(items, configSetting{key, values[key], settingSource(sources, key)})
|
||||
}
|
||||
columns := []terminal.Column{{Header: "Key"}, {Header: "Value", Flex: true}}
|
||||
if listSource {
|
||||
columns = append(columns, terminal.Column{Header: "Source"})
|
||||
items = append(items, configSetting{key, values[key]})
|
||||
}
|
||||
return writeTable(a, cmd, items, listSpec[configSetting]{
|
||||
Columns: columns,
|
||||
Columns: []terminal.Column{{Header: "Key"}, {Header: "Value", Flex: true}},
|
||||
Row: func(item configSetting) []terminal.Cell {
|
||||
row := []terminal.Cell{{Text: item.Key}, {Text: fmt.Sprint(item.Value)}}
|
||||
if listSource {
|
||||
row = append(row, terminal.Cell{Text: item.Source, Muted: true})
|
||||
}
|
||||
return row
|
||||
return []terminal.Cell{{Text: item.Key}, {Text: fmt.Sprint(item.Value)}}
|
||||
},
|
||||
}, listPage{Number: 1})
|
||||
},
|
||||
}
|
||||
list.Flags().BoolVar(&listSource, "show-source", false, "Show where each value comes from")
|
||||
group.AddCommand(list)
|
||||
group.AddCommand(&cobra.Command{
|
||||
Use: "set <key> <value>", Short: "Change a setting", Args: argsExact(2), ValidArgsFunction: a.completeConfig,
|
||||
|
||||
Reference in new issue
Block a user