-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reorgnize command names into their own folders
- Loading branch information
Showing
16 changed files
with
183 additions
and
127 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package fmt | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/jippi/dottie/pkg" | ||
"github.com/jippi/dottie/pkg/cli/shared" | ||
"github.com/urfave/cli/v3" | ||
) | ||
|
||
var Command = &cli.Command{ | ||
Name: "fmt", | ||
Usage: "Format the file", | ||
Action: func(ctx context.Context, cmd *cli.Command) error { | ||
env, _, err := shared.Setup(ctx, cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
pkg.Save(cmd.String("file"), env) | ||
|
||
return nil | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package json | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/jippi/dottie/pkg/cli/shared" | ||
"github.com/urfave/cli/v3" | ||
) | ||
|
||
var Command = &cli.Command{ | ||
Name: "json", | ||
Usage: "Print as JSON", | ||
Action: func(ctx context.Context, cmd *cli.Command) error { | ||
env, _, err := shared.Setup(ctx, cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
b, err := json.MarshalIndent(env, "", " ") | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Println(string(b)) | ||
|
||
return nil | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package print_cmd | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/jippi/dottie/pkg/cli/shared" | ||
"github.com/jippi/dottie/pkg/render" | ||
"github.com/urfave/cli/v3" | ||
) | ||
|
||
var Command = &cli.Command{ | ||
Name: "print", | ||
Usage: "Print environment variables", | ||
Action: func(ctx context.Context, cmd *cli.Command) error { | ||
env, settings, err := shared.Setup(ctx, cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
settings.Apply(render.WithInterpolation(true)) | ||
|
||
fmt.Println(render.NewRenderer(*settings).Statement(env).String()) | ||
|
||
return nil | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.