Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
01ead3bd73
|
|||
|
ae3c13d6d3
|
|||
| addcdd7354 |
19
README.md
19
README.md
@@ -35,17 +35,19 @@ The examples directory contains an example-scaffold-projectType.toml configurati
|
|||||||
|
|
||||||
## Naming convention warning
|
## Naming convention warning
|
||||||
|
|
||||||
Creating repositories on gitea via a ssh push has a side effect -- the project name is forced to lowercase. There are no configuration options to change this. Please see gitea and it's documentation for full explanations.
|
Creating repositories on gitea via a ssh push, the standard method, has a side effect -- the project name is forced to lowercase. There are no configuration options to change this. Please see gitea and it's documentation for full explanations.
|
||||||
|
|
||||||
Here are a couple of thoughts:
|
Here are a couple of thoughts:
|
||||||
|
|
||||||
1. Adapt and only create projects use lowercase (myspecialproject) or lowersnakecase (my_special_project) or use hyphens between words (my-special-project)
|
1. Adapt and only create projects using lowercase (myspecialproject) or lower_snake_case (my_special_project) or use hyphens between words (my-special-project)
|
||||||
- all lowercase is universally accepted but hard to read for multi-word project names
|
- all lowercase is universally accepted but hard to read for multi-word project names
|
||||||
- lowersnakecase is not universally accepted
|
- lower_snake_case is not universally accepted
|
||||||
- hyphens might not be what you are used to, or prefer, but it seems to be universally accepted and reasonably readable.
|
- hyphens might not be what you are used to, or prefer, but it seems to be universally accepted and reasonably readable.
|
||||||
|
|
||||||
2. A work around would be to manually create a reposity with the CamelCase name you want via gitea's web UI. And use scaffold with the -g flag
|
2. If you insist on CamelCase project names -- a work around would be to manually create a reposity with the CamelCase name you want via gitea's web UI. And then use scaffold on your development machine with the -c flag
|
||||||
eg. `scaffold -g MySpecialProject go MySpecialProject` to have scaffold clone it, build it out according to your skeleton/templates, and then push the changes.
|
eg. `scaffold -c go MySpecialProject` to have scaffold clone it from gitea, build it out according to your skeleton/templates, and then push the changes.
|
||||||
|
|
||||||
|
The whole idea or point to little utilities like this is to simplify things - to get what you want. In this case, it seems, that to get what you want means one extra step --OR-- changing your personal preference for the names of things.
|
||||||
|
|
||||||
## The `scaffold` command
|
## The `scaffold` command
|
||||||
|
|
||||||
@@ -53,10 +55,11 @@ Here are a couple of thoughts:
|
|||||||
| ------- | ----------- |
|
| ------- | ----------- |
|
||||||
| scaffold | The program name |
|
| scaffold | The program name |
|
||||||
| flags:
|
| flags:
|
||||||
-i or -Info | Display the available project types and the build and version information about the program. |
|
-i | Display the available project types and the build and version information about the program. |
|
||||||
| -g GiteaProjectName | Clone a gitea repository, not create one. Then push the new structure to it. |
|
| -c | Clone a gitea repository, not create one. Then push the new structure to it. |
|
||||||
| **Examples:** | |
|
| **Examples:** | |
|
||||||
| scaffold *ProjectType* *NewProjectName* | Stuff |
|
| scaffold *ProjectType* *new-project-name* | Creates a new project and then creates new remote repositories and pushes changes |
|
||||||
|
| scaffold -c *ProjectType* *GiteaRepositoryName* | clones the repo from gitea and then fills it according to your skeleton/template, and then pushes the changes.|
|
||||||
|
|
||||||
## Configuration of samples
|
## Configuration of samples
|
||||||
|
|
||||||
|
|||||||
9
main.go
9
main.go
@@ -49,7 +49,6 @@ type (
|
|||||||
var (
|
var (
|
||||||
infoFlag = flag.Bool("i", false, "Displays the program build information and exits.")
|
infoFlag = flag.Bool("i", false, "Displays the program build information and exits.")
|
||||||
cloneGiteaFlag = flag.Bool("c", false, "Clone from gitea. scaffold expects it to be an empty repository")
|
cloneGiteaFlag = flag.Bool("c", false, "Clone from gitea. scaffold expects it to be an empty repository")
|
||||||
giteaRepoFlag = flag.String("g", "", "Specifies a gitea repository to clone from rather than create")
|
|
||||||
sep = "/"
|
sep = "/"
|
||||||
cfg_dir = "devel/scaffold" // relative to <USER_CONFIG_DIR>, on linux /home/user/.config
|
cfg_dir = "devel/scaffold" // relative to <USER_CONFIG_DIR>, on linux /home/user/.config
|
||||||
cfg_filename = "scaffold-cfg.toml"
|
cfg_filename = "scaffold-cfg.toml"
|
||||||
@@ -72,10 +71,6 @@ func main() {
|
|||||||
fmt.Printf("Built: %s\n", buildTime)
|
fmt.Printf("Built: %s\n", buildTime)
|
||||||
|
|
||||||
fmt.Printf("Running on a %s system.\n", runtime.GOOS)
|
fmt.Printf("Running on a %s system.\n", runtime.GOOS)
|
||||||
fmt.Printf("Arg count: %+v\n", os.Args)
|
|
||||||
_ = isSSHAvailable()
|
|
||||||
|
|
||||||
fmt.Printf("Gitea repo: %s\n", *giteaRepoFlag)
|
|
||||||
|
|
||||||
at, err := availableProjectTypes(user_cfg_dir + sep + cfg_dir)
|
at, err := availableProjectTypes(user_cfg_dir + sep + cfg_dir)
|
||||||
ifFerr("Unable to get available project types", err)
|
ifFerr("Unable to get available project types", err)
|
||||||
@@ -86,6 +81,10 @@ func main() {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
sep = "\\"
|
||||||
|
}
|
||||||
|
|
||||||
// Setup scaffold
|
// Setup scaffold
|
||||||
u, err := user.Current()
|
u, err := user.Current()
|
||||||
ifFerr("Unable to get current user details", err)
|
ifFerr("Unable to get current user details", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user