Skip to content
This repository was archived by the owner on Mar 24, 2024. It is now read-only.

Commit fd5736d

Browse files
authored
Merge pull request #107 from ublue-os/spinning
fix: init --clone with existing system failure
2 parents b536f32 + 2aa9def commit fd5736d

File tree

5 files changed

+27
-13
lines changed

5 files changed

+27
-13
lines changed

grp/manpages/goreleaser

-49.9 MB
Binary file not shown.

grp/manpages/goreleaser.1.gz

-1.88 KB
Binary file not shown.

grp/manpages/grp.tar.gz

-15.7 MB
Binary file not shown.

internal/fleekcli/init.go

+26-12
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,7 @@ func initialize(cmd *cobra.Command) error {
5353
ux.Description.Println(cmd.Short)
5454
var upstream string
5555
loc := cmd.Flag(app.Trans("init.locationFlag")).Value.String()
56-
/*home, err := os.UserHomeDir()
57-
if err != nil {
58-
return err
59-
}
60-
// hack!
61-
//floc := filepath.Join(home, loc)
62-
*/
56+
6357
f.config = &core.Config{
6458
FlakeDir: loc,
6559
}
@@ -73,7 +67,6 @@ func initialize(cmd *cobra.Command) error {
7367
// clone it
7468
spinner, err := ux.Spinner().Start(app.Trans("init.cloning"))
7569
if err != nil {
76-
spinner.Fail()
7770
return err
7871
}
7972
err = f.config.Clone(upstream)
@@ -135,7 +128,6 @@ func initialize(cmd *cobra.Command) error {
135128
if err != nil {
136129
return err
137130
}
138-
139131
// only re-apply the templates if not `ejected`
140132
if !f.config.Ejected {
141133
if verbose {
@@ -166,18 +158,41 @@ func initialize(cmd *cobra.Command) error {
166158
if err != nil {
167159
return err
168160
}
161+
repo, err := f.Repo()
162+
if err != nil {
163+
return err
164+
}
165+
out, err := repo.Commit()
166+
if verbose {
167+
ux.Info.Println(string(out))
168+
}
169+
if err != nil {
170+
return err
171+
}
169172
}
170173
}
171-
172174
if verbose {
173175
ux.Info.Println(app.Trans("apply.writingFlake"))
174176
}
175177
err = f.flake.Write(includeSystems)
176178
if err != nil {
177179
return err
178180
}
181+
repo, err := f.Repo()
182+
if err != nil {
183+
return err
184+
}
185+
out, err := repo.Commit()
186+
if verbose {
187+
ux.Info.Println(string(out))
188+
}
189+
if err != nil {
190+
return err
191+
}
179192

180193
}
194+
spinner.Success()
195+
181196
ux.Info.Println(app.Trans("apply.applyingConfig"))
182197
out, err := f.flake.Apply()
183198
if err != nil {
@@ -186,13 +201,12 @@ func initialize(cmd *cobra.Command) error {
186201
if errors.Is(err, nix.ErrPackageConflict) {
187202
ux.Fatal.Println(app.Trans("global.errConflict"))
188203
}
189-
spinner.Fail()
190204
return err
191205
}
192206
if verbose {
193207
ux.Info.Println(string(out))
194208
}
195-
spinner.Success(app.Trans("apply.done"))
209+
ux.Info.Println(app.Trans("apply.done"))
196210
return nil
197211
}
198212
ux.Info.Println(app.Trans("init.cloned"))

locales/en.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ apply:
5353
commitError: "Error committing changes to local repository"
5454
checkingSystem: "Checking for current system in flake"
5555
newSystem: "New system detected"
56-
applyingConfig: "Applying config to flake"
56+
applyingConfig: "Applying config to flake, please wait..."
5757
dryApplyingConfig: "Not Applying config to flake, dry run"
5858
done: "Complete!"
5959
init:

0 commit comments

Comments
 (0)