Refactor flags.go and config.go #158

Closed
opened 2020-07-18 10:43:45 +00:00 by 6543 · 4 comments
Owner
  1. the global args now works without the strange workaround
  2. extend CTX to store the config and dont store any data in global values as it is done at the mement

-> make it "functional" again - at the moment it is not written as a normal functinal-lang-program intend to work

as mentioned by @zeripath in #156 too

1. the global args now works without the strange workaround 2. extend CTX to store the config and dont store any data in global values as it is done at the mement -> make it "functional" again - at the moment it is not written as a normal functinal-lang-program intend to work as mentioned by @zeripath in #156 too
6543 added this to the v0.5.0 milestone 2020-07-18 10:43:45 +00:00
6543 added the
kind
refactor
label 2020-07-18 10:43:45 +00:00
Author
Owner

unify initCommandLoginOnly() and initCommand()

unify initCommandLoginOnly() and initCommand()
6543 modified the milestone from v0.5.0 to v0.6.0 2020-09-14 01:23:20 +00:00
6543 modified the milestone from v0.6.0 to v0.7.0 2020-12-08 11:32:30 +00:00
noerw referenced this issue from a commit 2020-12-08 22:48:03 +00:00
Member

@6543 I propose to change the call signature of InitCommand(), to return all context generated during initialization to any command:

- func InitCommand(repoFlag, loginFlag, remoteFlag string) (login *Login, owner string, reponame string)
+ func InitCommand(ctx *cli.Context, localRepoRequired bool) TeaContext
+
+type TeaContext struct {
+    cli.Context
+    Login     Login
+    RepoSlug  string
+    Owner     string
+    Repo      string
+    Config    *LocalConfig
+    LocalRepo *git.TeaRepo // maybe, we have opened it already anyway
+}

Passing cli.Context in, we should be able to remove global flag variables, right?

@6543 I propose to change the call signature of InitCommand(), to return all context generated during initialization to any command: ```diff - func InitCommand(repoFlag, loginFlag, remoteFlag string) (login *Login, owner string, reponame string) + func InitCommand(ctx *cli.Context, localRepoRequired bool) TeaContext + +type TeaContext struct { + cli.Context + Login Login + RepoSlug string + Owner string + Repo string + Config *LocalConfig + LocalRepo *git.TeaRepo // maybe, we have opened it already anyway +} ``` Passing cli.Context in, we should be able to remove global flag variables, right?
Author
Owner

@noerw not a bad idear, yes this should do it

Let me have a look at it once #285 got merged

@noerw not a bad idear, yes this should do it Let me have a look at it once #285 got merged
6543 referenced this issue from a commit 2020-12-11 09:07:29 +00:00
6543 referenced this issue from a commit 2020-12-11 10:00:46 +00:00
Author
Owner

befor introducing a TeaContext ... we should make sure Config is loeaded and not every module can acces the config var as it like to ...

-> #288

befor introducing a TeaContext ... we should make sure Config is loeaded and not every module can acces the config var as it like to ... -> #288
6543 closed this issue 2020-12-15 17:38:24 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/tea#158
No description provided.