Skip to content
This repository was archived by the owner on Feb 4, 2026. It is now read-only.

Commit 52954d4

Browse files
committed
refactor: rename local repository -> project scope
1 parent 4d2f235 commit 52954d4

File tree

10 files changed

+23
-23
lines changed

10 files changed

+23
-23
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ $ sqlpkg help
1313
│ Commands: │
1414
│ help Display help │
1515
│ info Display package information │
16-
│ init Create local repository
16+
│ init Init project scope
1717
│ install Install packages │
1818
│ list List installed packages │
1919
│ uninstall Uninstall package │
@@ -174,9 +174,9 @@ sqlpkg version
174174

175175
Displays `sqlpkg` version number.
176176

177-
## Using a local repository
177+
## Project vs. global scope
178178

179-
By default, `sqlpkg` installs all extensions in the home folder. If you are writing a Python (JavaScript, Go, ...) application — you may prefer to put them in the project folder (like virtual environment in Python or `node_modules` in JavaScript).
179+
By default, `sqlpkg` installs all extensions in the home folder (global scope). If you are writing a Python (JavaScript, Go, ...) application — you may prefer to put them in the project folder (project scope, like virtual environment in Python or `node_modules` in JavaScript).
180180

181181
To do that, run the `init` command:
182182

@@ -194,7 +194,7 @@ If you _are_ a package author, who wants your package to be installable by `sqlp
194194

195195
## Lockfile
196196

197-
`sqlpkg` stores information about the installed packages in a special file (the _lockfile_) — `sqlpkg.lock`. If you're using a local repository, it's a good idea to commit `sqlpkg.lock` along with other code. This way, when you check out the code on another machine, you can install all the packages at once.
197+
`sqlpkg` stores information about the installed packages in a special file (the _lockfile_) — `sqlpkg.lock`. If you're using a project scope, it's a good idea to commit `sqlpkg.lock` along with other code. This way, when you check out the code on another machine, you can install all the packages at once.
198198

199199
To install the packages listed in the lockfile, simply run `install` with no arguments:
200200

cmd/cmd.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ func GetPathByFullName(fullName string) (string, error) {
4141
return path, nil
4242
}
4343

44-
// PrintLocalRepo prints information about the local sqlpkg repository.
45-
func PrintLocalRepo() {
44+
// PrintScope prints information about the current scope (project/global).
45+
func PrintScope() {
4646
if WorkDir == "." {
47-
logx.Log("(local repository)")
47+
logx.Log("(project scope)")
4848
}
4949
}
5050

cmd/cmd_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func TestGetDirByFullName(t *testing.T) {
7171
})
7272
}
7373

74-
func TestPrintLocalRepo(t *testing.T) {
74+
func TestPrintScope(t *testing.T) {
7575
mem := logx.Mock()
7676
home, err := os.UserHomeDir()
7777
if err != nil {
@@ -80,19 +80,19 @@ func TestPrintLocalRepo(t *testing.T) {
8080

8181
t.Run("home dir", func(t *testing.T) {
8282
WorkDir = home
83-
PrintLocalRepo()
83+
PrintScope()
8484
if len(mem.Lines) != 0 {
85-
t.Fatalf("PrintLocalRepo: unexpected line count %v", len(mem.Lines))
85+
t.Fatalf("PrintScope: unexpected line count %v", len(mem.Lines))
8686
}
8787
})
8888
t.Run("project dir", func(t *testing.T) {
8989
WorkDir = "."
90-
PrintLocalRepo()
90+
PrintScope()
9191
if len(mem.Lines) != 1 {
92-
t.Fatalf("PrintLocalRepo: unexpected line count %v", len(mem.Lines))
92+
t.Fatalf("PrintScope: unexpected line count %v", len(mem.Lines))
9393
}
94-
if !mem.Has("(local repository)") {
95-
t.Errorf("PrintLocalRepo: unexpected output %v", mem.Lines)
94+
if !mem.Has("(project scope)") {
95+
t.Errorf("PrintScope: unexpected output %v", mem.Lines)
9696
}
9797
})
9898
}

cmd/help/help.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const help = "usage: sqlpkg help"
1414
var commandsHelp = map[string]string{
1515
"help": "Display help",
1616
"info": "Display package information",
17-
"init": "Create local repository",
17+
"init": "Init project scope",
1818
"install": "Install packages",
1919
"list": "List installed packages",
2020
"uninstall": "Uninstall package",

cmd/init/init.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ func Init(args []string) error {
2424

2525
err := os.Mkdir(spec.DirName, 0755)
2626
if err != nil {
27-
return fmt.Errorf("failed to create a local repository: %w", err)
27+
return fmt.Errorf("failed to create a project scope: %w", err)
2828
}
2929

30-
logx.Log("✓ created a local repository")
30+
logx.Log("✓ created a project scope")
3131
return nil
3232
}

cmd/init/init_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestInit(t *testing.T) {
2020
}
2121

2222
mem.Print()
23-
mem.MustHave(t, "created a local repository")
23+
mem.MustHave(t, "created a project scope")
2424
}
2525

2626
func TestAlreadyExists(t *testing.T) {

cmd/install/install.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const installHelp = "usage: sqlpkg install [package]"
1313

1414
// InstallAll installs all packages from the lockfile.
1515
func InstallAll(args []string) error {
16-
cmd.PrintLocalRepo()
16+
cmd.PrintScope()
1717

1818
lck, err := cmd.ReadLockfile()
1919
if err != nil {
@@ -48,7 +48,7 @@ func Install(args []string) error {
4848
return errors.New(installHelp)
4949
}
5050

51-
cmd.PrintLocalRepo()
51+
cmd.PrintScope()
5252

5353
path := args[0]
5454
err := installPackage(path)

cmd/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func sortPackages(packages []*spec.Package) {
9393

9494
// printPackages prints packages.
9595
func printPackages(packages []*spec.Package) {
96-
cmd.PrintLocalRepo()
96+
cmd.PrintScope()
9797
if len(packages) == 0 {
9898
logx.Log("no packages installed")
9999
return

cmd/uninstall/uninstall.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func Uninstall(args []string) error {
1818
return errors.New(uninstallHelp)
1919
}
2020

21-
cmd.PrintLocalRepo()
21+
cmd.PrintScope()
2222

2323
fullName := args[0]
2424
logx.Log("> uninstalling %s...", fullName)

cmd/update/update.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func UpdateAll(args []string) error {
1919
return errors.New(updateHelp)
2020
}
2121

22-
cmd.PrintLocalRepo()
22+
cmd.PrintScope()
2323

2424
pattern := filepath.Join(cmd.WorkDir, spec.DirName, "*", "*", spec.FileName)
2525
paths, _ := filepath.Glob(pattern)

0 commit comments

Comments
 (0)