{"id":50445901,"url":"https://github.com/devsimsek/plasm","last_synced_at":"2026-05-31T21:30:59.615Z","repository":{"id":257195494,"uuid":"846738229","full_name":"devsimsek/plasm","owner":"devsimsek","description":"Plasm is a entrypoint for you to build your own cli applications.","archived":false,"fork":false,"pushed_at":"2024-08-23T21:10:34.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-21T00:02:07.357Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devsimsek.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-23T21:10:25.000Z","updated_at":"2024-08-23T21:10:37.000Z","dependencies_parsed_at":"2024-09-15T09:03:53.047Z","dependency_job_id":null,"html_url":"https://github.com/devsimsek/plasm","commit_stats":null,"previous_names":["devsimsek/plasm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devsimsek/plasm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsimsek%2Fplasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsimsek%2Fplasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsimsek%2Fplasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsimsek%2Fplasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devsimsek","download_url":"https://codeload.github.com/devsimsek/plasm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devsimsek%2Fplasm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33750474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-31T21:30:58.815Z","updated_at":"2026-05-31T21:30:59.610Z","avatar_url":"https://github.com/devsimsek.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Plasm - A cli entrypoint for your applications.\n\nPlasm is a entrypoint for you to build your own cli applications. It provides a simple interface to build your own commands and subcommands.\nI would love to call this project as a \"cli framework\" but it's not a framework, it's just a simple entrypoint for your cli applications. Maybe in the future, I will add more features to call it a framework.\n\n## Developing Using Plasm\n\nTo create a new command, you need to create a new file in the `commands` directory. After the creation, you should register your command in the init function.\nFor example, let's create a new command called `hello` located at `commands/hello.go`:\n\n```go\npackage commands\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/devsimsek/plasm/core\"\n\t\"github.com/devsimsek/plasm/types\"\n)\n\nfunc init() {\n\tcore.RegisterCommand(types.Command{\n\t\tName:  \"hello\",\n\t\tAlias: []string{\"h\"},\n\t\tFlags: []types.Flag{\n\t\t\t{Name: \"name\", Alias: []string{\"n\"}, Value: \"\"},\n\t\t},\n\t\tDescription: \"Say hello to someone\",\n\t\tHandler:     func(flags []types.Flag) {\n\t\t\tname := core.FindFlag(flags, \"name\")\n\t\t\tif name == \"\" {\n\t\t\t\tfmt.Println(\"Hello, World!\")\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Hello, %s!\\n\", name)\n\t\t\t}\n\t\t},\n\t})\n}\n```\n\nIts that simple! Now you can run your command by running `go run . hello` or `go run . h`.\n\nTo create a type/model, you can create a new file in the `types` directory. For example, let's create a new type called `User` located at `types/user.go` that leverages Gorm:\n\n```go\npackage types\n\nimport (\n\t\"gorm.io/gorm\"\n)\n\n// User struct to represent a user\ntype User struct {\n\tgorm.Model\n\tName  string `json:\"name\"`\n\tSurname string `json:\"surname\"`\n\tEmail string `json:\"email\"`\n}\n\nfunc init() {\n\t// Register the User model as a migration, so that it can be migrated to the database\n\tMigrations = append(Migrations, Migration{\n\t\tName:  \"User\",\n\t\tModel: \u0026User{},\n\t\tSeed:  []User{\n\t\t\t// Seeding is this easy!\n\t\t\t{Name: \"John\", Surname: \"Doe\", Email: \"john@does.com\"},\n\t\t},\n\t})\n}\n\n// TableName sets the table name for the User model in the database\nfunc (t *User) TableName() string {\n\treturn \"users\"\n}\n\n// GetAll fetches all users from the database\nfunc (t *User) GetAll() ([]User, error) {\n\tvar users []User\n\tresult := DB.Find(\u0026users)\n\tif result.Error != nil {\n\t\treturn nil, result.Error\n\t}\n\treturn users, nil\n}\n\n// GetById fetches a single user by ID\nfunc (t *User) GetById(id int) (*User, error) {\n\tvar user User\n\tresult := DB.First(\u0026user, id)\n\tif result.Error != nil {\n\t\treturn nil, result.Error\n\t}\n\treturn \u0026user, nil\n}\n\n// Create inserts a new user into the database\nfunc (t *User) Create() error {\n\tresult := DB.Create(t)\n\treturn result.Error\n}\n\n// Update updates an existing user in the database\nfunc (t *User) Update() error {\n\tresult := DB.Save(t)\n\treturn result.Error\n}\n\n// Delete removes a user from the database\nfunc (t *User) Delete() error {\n\tresult := DB.Delete(t)\n\treturn result.Error\n}\n\n// Find fetches users based on a query\nfunc (t *User) Find(query string) ([]User, error) {\n\tvar users []User\n\tresult := DB.Where(\"name LIKE ?\", \"%\"+query+\"%\").Find(\u0026users)\n\tif result.Error != nil {\n\t\treturn nil, result.Error\n\t}\n\treturn users, nil\n}\n\n// Count fetches the total number of users\nfunc (t *User) Count() (int64, error) {\n\tvar count int64\n\tresult := DB.Model(\u0026User{}).Count(\u0026count)\n\tif result.Error != nil {\n\t\treturn 0, result.Error\n\t}\n\treturn count, nil\n}\n```\n\nNow you can use the User model in your commands. For example, let's create a new command called `users` located at `commands/users.go`:\n\n```go\npackage commands\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/devsimsek/plasm/core\"\n\t\"github.com/devsimsek/plasm/types\"\n)\n\nfunc init() {\n\tcore.RegisterCommand(types.Command{\n\t\tName:  \"find\",\n\t\tAlias: []string{\"f\"},\n\t\tFlags: []types.Flag{\n\t\t\t{Name: \"query\", Alias: []string{\"q\"}, Value: \"\"},\n\t\t},\n\t\tDescription: \"Find users by name\",\n\t\tHandler:     func(flags []types.Flag) {\n\t\t\tquery := core.FindFlag(flags, \"query\")\n\t\t\tif query == \"\" {\n\t\t\t\tfmt.Println(\"Please provide a query\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tuser := types.User{}\n\t\t\tusers, err := user.Find(query)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfor _, u := range users {\n\t\t\t\tfmt.Printf(\"ID: %d, Name: %s, Surname: %s, Email: %s\\n\", u.ID, u.Name, u.Surname, u.Email)\n\t\t\t}\n\t\t},\n\t})\n}\n```\n\nNow you can run your command by running `go run . users find --query=John`.\n\n## Installation\n\nTo install Plasm, you can run the following command:\n\n```bash\n    git clone https://github.com/devsimsek/plasm.git myapp\n    cd myapp\n    go mod tidy\n```\n\n## Run Locally\n\nTo run the project locally, you can run the following command:\n\n```bash\n    go run .\n```\n\n## Features\n\n- Simple interface to build your own commands and subcommands\n- Easy to use\n- Easy to extend\n- Gorm support for database operations\n- Easy to use configuration\n\n## Feedback\n\nIf you have any feedback, please reach out to me using the issues tab.\nAlso, I don't have a lot of time to maintain this project, so if you want to contribute, feel free to open a pull request.\n\n## License\n\n[MIT](https://devsimsek.mit-license.org/)\nor\nlicense.md file in the root directory.\n\n## Authors\n\n- [@devsimsek](https://github.com/devsimsek)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevsimsek%2Fplasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevsimsek%2Fplasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevsimsek%2Fplasm/lists"}