generated from LinuxSuRen/github-go
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8794ae
commit fc8b905
Showing
4 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
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,58 @@ | ||
package apt | ||
|
||
import ( | ||
"fmt" | ||
"github.com/linuxsuren/http-downloader/pkg/exec" | ||
"runtime" | ||
) | ||
|
||
// asciinemaInstallerInUbuntu is the installer of asciinema in CentOS | ||
type asciinemaInstallerInUbuntu struct { | ||
count int | ||
} | ||
|
||
// Available check if support current platform | ||
func (d *asciinemaInstallerInUbuntu) Available() (ok bool) { | ||
if runtime.GOOS == "linux" { | ||
_, err := exec.LookPath("apt-get") | ||
ok = err == nil | ||
} | ||
return | ||
} | ||
|
||
// Install installs the asciinema | ||
func (d *asciinemaInstallerInUbuntu) Install() (err error) { | ||
if err = exec.RunCommand("apt-get", "update", "-y"); err != nil { | ||
return | ||
} | ||
if err = exec.RunCommand("apt-get", "install", "-y", | ||
"asciinema"); err != nil { | ||
return | ||
} | ||
return | ||
} | ||
|
||
// Uninstall uninstalls the asciinema | ||
func (d *asciinemaInstallerInUbuntu) Uninstall() (err error) { | ||
err = exec.RunCommand("apt-get", "remove", "-y", | ||
"asciinema") | ||
return | ||
} | ||
|
||
// WaitForStart waits for the service be started | ||
func (d *asciinemaInstallerInUbuntu) WaitForStart() (ok bool, err error) { | ||
ok = true | ||
return | ||
} | ||
|
||
// Start starts the asciinema service | ||
func (d *asciinemaInstallerInUbuntu) Start() error { | ||
fmt.Println("not supported yet") | ||
return nil | ||
} | ||
|
||
// Stop stops the asciinema service | ||
func (d *asciinemaInstallerInUbuntu) Stop() error { | ||
fmt.Println("not supported yet") | ||
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,51 @@ | ||
package brew | ||
|
||
import ( | ||
"fmt" | ||
"github.com/linuxsuren/http-downloader/pkg/exec" | ||
"runtime" | ||
) | ||
|
||
// asciinemaInstallerInMacOS is the installer of asciinema in CentOS | ||
type asciinemaInstallerInMacOS struct { | ||
count int | ||
} | ||
|
||
// Available check if support current platform | ||
func (d *asciinemaInstallerInMacOS) Available() (ok bool) { | ||
if runtime.GOOS == "darwin" { | ||
_, err := exec.LookPath("brew") | ||
ok = err == nil | ||
} | ||
return | ||
} | ||
|
||
// Install installs the asciinema | ||
func (d *asciinemaInstallerInMacOS) Install() (err error) { | ||
err = exec.RunCommand("brew", "install", "asciinema") | ||
return | ||
} | ||
|
||
// Uninstall uninstalls the asciinema | ||
func (d *asciinemaInstallerInMacOS) Uninstall() (err error) { | ||
err = exec.RunCommand("brew", "remove", "asciinema") | ||
return | ||
} | ||
|
||
// WaitForStart waits for the service be started | ||
func (d *asciinemaInstallerInMacOS) WaitForStart() (ok bool, err error) { | ||
ok = true | ||
return | ||
} | ||
|
||
// Start starts the asciinema service | ||
func (d *asciinemaInstallerInMacOS) Start() error { | ||
fmt.Println("not supported yet") | ||
return nil | ||
} | ||
|
||
// Stop stops the asciinema service | ||
func (d *asciinemaInstallerInMacOS) Stop() error { | ||
fmt.Println("not supported yet") | ||
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