refactor!: rename oo-cli → oo, split library by domain, relocate applications
BREAKING:
- Binary renamed oo-cli → oo; install path is now
github.com/eslider/go-onlyoffice/cmd/oo.
- Former internal/cli tree removed; cobra commands live in cmd/oo/ as
package main, split by domain (calendar.go, crm.go, tasks.go, apps.go,
common.go, main.go).
- internal/applications moved to cmd/oo/applications/ (CV-specific workflow;
not a library feature).
- examples/applications removed (it depended on an internal package).
Library split (mechanical, zero API surface change):
- client.go — Client, Credentials, Defaults, env helpers, NewClient.
- request.go — Request, Query, Time, Token, MetaResponse, Permissions.
- auth.go — Authenticate/AuthenticateContext/InvalidateToken.
- http.go — transport + ResponseArray/ResponseObject/postFormObject/
putFormObject/deleteObject/unmarshalResponseObject (renamed
from httpx.go).
- projects.go, tasks.go, users.go, calendar.go, crm.go, files.go — typed
/ untyped domain methods. tasks_extra.go merged into tasks.go.
- onlyoffice.go deleted (content redistributed).
AGENTS.md, CHANGELOG.md, README.md updated accordingly.
Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/eslider/go-onlyoffice/cmd/oo/applications"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func cmdAppsSync() *cobra.Command {
|
||||
var apply, verbose bool
|
||||
var base string
|
||||
cmd := &cobra.Command{
|
||||
Use: "applications-sync",
|
||||
Short: "Sync applications/*/README.md into CRM",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
c, err := newOO()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if base == "" {
|
||||
return fmt.Errorf("use --path to applications year dir (e.g. .../applications/2026)")
|
||||
}
|
||||
paths, err := applications.Discover(base)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var apps []applications.Data
|
||||
for _, p := range paths {
|
||||
a, err := applications.ParseReadme(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if a.Position == "" && a.Company == "" {
|
||||
continue
|
||||
}
|
||||
apps = append(apps, a)
|
||||
}
|
||||
fmt.Printf("Found %d application(s)\n", len(apps))
|
||||
applications.Sync(cmd.Context(), c, apps, !apply, verbose)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
cmd.Flags().BoolVar(&apply, "apply", false, "write to CRM (default dry-run)")
|
||||
cmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "")
|
||||
cmd.Flags().StringVar(&base, "path", "", "applications base directory")
|
||||
return cmd
|
||||
}
|
||||
Reference in New Issue
Block a user