-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #933 from rsteube/python-httpserver-module
python: added http.server module
- Loading branch information
Showing
2 changed files
with
34 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,32 @@ | ||
package module | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/pkg/actions/net" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func ExecuteHttpServer() error { | ||
cmd := &cobra.Command{ | ||
Use: "http.server", | ||
Short: "simple http server", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
carapace.Gen(cmd).Standalone() | ||
|
||
cmd.Flags().StringP("bind", "b", "", "Specify alternate bind address") | ||
cmd.Flags().Bool("cgi", false, "Run as CGI Server") | ||
cmd.Flags().StringP("directory", "d", "", "Specify alternative directory") | ||
cmd.Flags().BoolP("help", "h", false, "show this help message and exit") | ||
|
||
carapace.Gen(cmd).FlagCompletion(carapace.ActionMap{ | ||
"directory": carapace.ActionDirectories(), | ||
}) | ||
|
||
carapace.Gen(cmd).PositionalCompletion( | ||
net.ActionPorts(), | ||
) | ||
|
||
return cmd.Execute() | ||
} |
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