GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — no longer need a flag on create · commitdev/zero@afc46a9

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • cmd
    • create.go
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎cmd/create.go‎

Copy file name to clipboardExpand all lines: cmd/create.go
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,24 @@ import (
88
"github.com/spf13/cobra"
99
)
1010

11-
var projectName string
12-
1311
func init() {
1412

15-
createCmd.PersistentFlags().StringVarP(&projectName, "project-name", "p", "", "project name")
16-
1713
rootCmd.AddCommand(createCmd)
1814
}
1915

2016
var createCmd = &cobra.Command{
2117
Use: "create",
22-
Short: "Create new project.",
18+
Short: "Create new project with provided name.",
2319
Run: func(cmd *cobra.Command, args []string) {
20+
projectName := args[0]
21+
if projectName == "" {
22+
log.Panicf("Project name cannot be empty!")
23+
}
2424

2525
rootDir := fmt.Sprintf("./%v", projectName)
2626

27+
log.Printf("Creating project %s.", projectName)
28+
2729
err := os.Mkdir(rootDir, os.ModePerm)
2830
if os.IsExist(err) {
2931
log.Fatalf("Directory %v already exists! Error: %v", projectName, err)

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.