@@ -55,7 +55,7 @@ func runSubmit(cfg config.Config, flags *pflag.FlagSet, args []string) error {
55
55
return err
56
56
}
57
57
58
- ctx , err := newSubmitContext (cfg .UserViperConfig , flags , args )
58
+ ctx , err := newSubmitCmdContext (cfg .UserViperConfig , flags , args )
59
59
if err != nil {
60
60
return err
61
61
}
@@ -68,16 +68,16 @@ func runSubmit(cfg config.Config, flags *pflag.FlagSet, args []string) error {
68
68
return nil
69
69
}
70
70
71
- // submitContext is a context for submitting solutions to the API .
72
- type submitContext struct {
71
+ // submitCmdContext represents the context for the submit cmd .
72
+ type submitCmdContext struct {
73
73
usrCfg * viper.Viper
74
74
flags * pflag.FlagSet
75
75
submission
76
76
}
77
77
78
- // newSubmitContext creates a submitContext .
79
- func newSubmitContext (usrCfg * viper.Viper , flags * pflag.FlagSet , args []string ) (* submitContext , error ) {
80
- ctx := & submitContext {usrCfg : usrCfg , flags : flags }
78
+ // newSubmitCmdContext sets up a context to initiate a submission .
79
+ func newSubmitCmdContext (usrCfg * viper.Viper , flags * pflag.FlagSet , args []string ) (* submitCmdContext , error ) {
80
+ ctx := & submitCmdContext {usrCfg : usrCfg , flags : flags }
81
81
82
82
filepaths , err := ctx .sanitizeArgs (args )
83
83
if err != nil {
@@ -108,7 +108,7 @@ func newSubmitContext(usrCfg *viper.Viper, flags *pflag.FlagSet, args []string)
108
108
}
109
109
110
110
// sanitizeArgs validates args and swaps with evaluated symlink paths.
111
- func (s * submitContext ) sanitizeArgs (args []string ) ([]string , error ) {
111
+ func (s * submitCmdContext ) sanitizeArgs (args []string ) ([]string , error ) {
112
112
for i , arg := range args {
113
113
var err error
114
114
arg , err = filepath .Abs (arg )
@@ -154,7 +154,7 @@ func (s *submitContext) sanitizeArgs(args []string) ([]string, error) {
154
154
return args , nil
155
155
}
156
156
157
- func (s * submitContext ) exercise (filepaths []string ) (workspace.Exercise , error ) {
157
+ func (s * submitCmdContext ) exercise (filepaths []string ) (workspace.Exercise , error ) {
158
158
ws , err := workspace .New (s .usrCfg .GetString ("workspace" ))
159
159
if err != nil {
160
160
return workspace.Exercise {}, err
@@ -184,7 +184,7 @@ func (s *submitContext) exercise(filepaths []string) (workspace.Exercise, error)
184
184
return workspace .NewExerciseFromDir (exerciseDir ), nil
185
185
}
186
186
187
- func (s * submitContext ) migrateLegacyMetadata (exercise workspace.Exercise ) error {
187
+ func (s * submitCmdContext ) migrateLegacyMetadata (exercise workspace.Exercise ) error {
188
188
migrationStatus , err := exercise .MigrateLegacyMetadataFile ()
189
189
if err != nil {
190
190
return err
@@ -195,7 +195,7 @@ func (s *submitContext) migrateLegacyMetadata(exercise workspace.Exercise) error
195
195
return nil
196
196
}
197
197
198
- func (s * submitContext ) _metadata (exercise workspace.Exercise ) (* workspace.ExerciseMetadata , error ) {
198
+ func (s * submitCmdContext ) _metadata (exercise workspace.Exercise ) (* workspace.ExerciseMetadata , error ) {
199
199
metadata , err := workspace .NewExerciseMetadata (exercise .Filepath ())
200
200
if err != nil {
201
201
return nil , err
@@ -230,7 +230,7 @@ func (s *submitContext) _metadata(exercise workspace.Exercise) (*workspace.Exerc
230
230
return metadata , nil
231
231
}
232
232
233
- func (s * submitContext ) _documents (filepaths []string , exercise workspace.Exercise ) ([]workspace.Document , error ) {
233
+ func (s * submitCmdContext ) _documents (filepaths []string , exercise workspace.Exercise ) ([]workspace.Document , error ) {
234
234
docs := make ([]workspace.Document , 0 , len (filepaths ))
235
235
for _ , file := range filepaths {
236
236
// Don't submit empty files
0 commit comments