Skip to content
This repository was archived by the owner on Jul 26, 2020. It is now read-only.
This repository was archived by the owner on Jul 26, 2020. It is now read-only.

Refactor Bake CLI #1

@jmickey

Description

@jmickey

Description

Currently, the bake CLI is both out-of-date with the current state of the repo (see #171), and rather difficult to maintain. In order to improve the situation I have some suggestions and ideas.

App Structure

Moving to the hexagonal architecture pattern for structuring the app. Inspiration and more info can be found in this great talk by @katzien:

Video
Slides
golang-standards/project-layout

I propose moving to the following structure:

bake/
├── cmd/
│   ├── root.go
│   └── other-commands.go
└── pkg/
    ├── creators/
    │   └── creator.go
    └── providers/
        ├── provider.go
        ├── youtube.go
        └── some-other-provider.go

API Design

APIs should provide clear and generic interfaces. In the case of a provider, each provider should have a common set of functions that ensures it conforms to the provider interface. E.g. <provider>.Load(), <provider>.Add(), <provider>.Delete() etc.

Creator will consume providers, with config passed from cmd into the creator.
Example of the code workflow (I haven't tested this code, it's just an idea):

package cmd

import (
  "github.com/breadtubetv/breadtubetv/bake/pkg/creators"
  "github.com/spf13/viper
)

var creator creators.Creator
creator.AddConfig(viper.GetViper())
if creator = creators.Get('slug') == nil {
  // Add a creator if not found
  creator = creator.Create('slug', 'initial-provider', 'url')
}

creator.Providers.Add('twitter')
creator.Provider['twitter'].Update(("followers", 1200000))

...and so on.

This will provide us with an easy way of adding new providers, which can easily be added to creators, which in term can easily be consumed by the CLI.

Implementation

WIP

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestin progressIssue is being actively worked onxp/developerAims to improve the experience for BreadTube developers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions