(config config.AppConfigurer)
| 61 | } |
| 62 | |
| 63 | func NewCommon(config config.AppConfigurer) (*common.Common, error) { |
| 64 | userConfig := config.GetUserConfig() |
| 65 | appState := config.GetAppState() |
| 66 | log := newLogger(config) |
| 67 | // Initialize with English for the time being; the real translation set for |
| 68 | // the configured language will be read after reading the user config |
| 69 | tr := i18n.EnglishTranslationSet() |
| 70 | |
| 71 | cmn := &common.Common{ |
| 72 | Log: log, |
| 73 | Tr: tr, |
| 74 | AppState: appState, |
| 75 | Debug: config.GetDebug(), |
| 76 | Fs: afero.NewOsFs(), |
| 77 | } |
| 78 | cmn.SetUserConfig(userConfig) |
| 79 | return cmn, nil |
| 80 | } |
| 81 | |
| 82 | func newLogger(cfg config.AppConfigurer) *logrus.Entry { |
| 83 | if cfg.GetDebug() { |
no test coverage detected