BREAKING:
- Flat oo verb-noun layout replaced with subject → verb, mirroring the
gitea `tea` CLI. Every subject is one file in cmd/oo/:
oo calendar list | events | add | delete
oo projects list | get | milestones | create | update | delete
oo tasks list | get | create | update | delete | subtask add
oo users list | self (alias: oo whoami)
oo contacts list | get | delete | info-add
oo persons list | create | delete
oo companies list | create | delete
oo opportunities list | get | create | delete | stages | member-add
oo cases list | create | delete | member-add
oo crm-tasks list | create | delete | categories
oo applications sync
- Global `--output/-o table|json` flag on the root command; every list uses
a single printTable helper that flattens nested bidCurrency → abbreviation
for readability, truncates long cells, and dumps verbatim in JSON mode.
Library additions surfaced in the CLI:
- oo users / oo whoami via SelfUserID + GetUsers.
- oo projects full CRUD via Create/Update/Delete/GetProjectByID/Milestones.
- oo crm-tasks and oo cases via ListCRMTasks/CreateCRMTask/DeleteCRMTask/
ListTaskCategories/ListCases/CreateCase/DeleteCase/AddCaseMember.
- oo contacts info-add via AddContactInfo.
- oo opportunities stages/member-add via ListDealStages/AddOpportunityMember.
Internal:
- cmd/oo/common.go — rootCmd, newOO (uses AuthenticateContext), printTable,
printObject, fmtCell, deref* helpers.
- cmd/oo/crm.go deleted; content split into contacts.go, opportunities.go,
cases.go, crm_tasks.go for locality.
Docs:
- README: new subject→verb table + migration note.
- AGENTS.md: CLI section rewritten; new rule enforcing subject→verb and
printTable/printObject routing.
- CHANGELOG: 0.5.0 entry with full old→new mapping.
Made-with: Cursor
60 lines
1.5 KiB
Go
60 lines
1.5 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/eslider/go-onlyoffice/cmd/oo/applications"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var applicationsCmd = &cobra.Command{
|
|
Use: "applications",
|
|
Aliases: []string{"apps"},
|
|
Short: "Job-application workflow (CV tree → CRM)",
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(applicationsCmd)
|
|
applicationsCmd.AddCommand(applicationsSyncCmd())
|
|
}
|
|
|
|
func applicationsSyncCmd() *cobra.Command {
|
|
var apply, verbose bool
|
|
var base string
|
|
cmd := &cobra.Command{
|
|
Use: "sync",
|
|
Short: "Sync applications/*/README.md into CRM (dry-run by default)",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
c, err := newOO(cmd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if base == "" {
|
|
return fmt.Errorf("--path is required (points at 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
|
|
}
|