From 6296da685a24050f4cb5f516a1360a515dbaa44f Mon Sep 17 00:00:00 2001 From: Junya Okabe Date: Fri, 26 Jan 2024 09:45:07 +0900 Subject: [PATCH 1/4] feat: impl cmd_rm.go --- cmd_rm.go | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++ commands.go | 11 +++++++++ 2 files changed, 79 insertions(+) create mode 100644 cmd_rm.go diff --git a/cmd_rm.go b/cmd_rm.go new file mode 100644 index 0000000..f2bdcbc --- /dev/null +++ b/cmd_rm.go @@ -0,0 +1,68 @@ +package main + +import ( + "fmt" + "os" + + "github.com/urfave/cli/v2" +) + +func doRm(c *cli.Context) error { + var ( + name = c.Args().First() + dry = c.Bool("dry-run") + w = c.App.Writer + ) + + if name == "" { + return fmt.Errorf("repository name is required") + } + + u, err := newURL(name, false, true) + if err != nil { + return err + } + + localRepo, err := LocalRepositoryFromURL(u) + if err != nil { + return err + } + + p := localRepo.FullPath + ok, err := isNotExistOrEmpty(p) + if err != nil { + return err + } + if ok { + return fmt.Errorf("directory %q does not exist", p) + } + + if dry { + fmt.Fprintf(w, "Would remove %s\n", p) + return nil + } + + ok, err = confirm(fmt.Sprintf("Remove %s?", p)) + if err != nil { + return err + } + if !ok { + return fmt.Errorf("aborted") + } + + if err := os.RemoveAll(p); err != nil { + return err + } + + fmt.Fprintf(w, "Removed %s\n", p) + return nil +} + +func confirm(message string) (bool, error) { + fmt.Fprintf(os.Stderr, "%s [y/N]: ", message) + var response string + if _, err := fmt.Scanln(&response); err != nil { + return false, err + } + return response == "y", nil +} diff --git a/commands.go b/commands.go index aae1c2f..abbd35f 100644 --- a/commands.go +++ b/commands.go @@ -10,6 +10,7 @@ import ( var commands = []*cli.Command{ commandGet, commandList, + commandRm, commandRoot, commandCreate, } @@ -57,6 +58,15 @@ var commandList = &cli.Command{ }, } +var commandRm = &cli.Command{ + Name: "rm", + Usage: "Remove local repository", + Action: doRm, + Flags: []cli.Flag{ + &cli.BoolFlag{Name: "dry-run", Usage: "Do not remove actually"}, + }, +} + var commandRoot = &cli.Command{ Name: "root", Usage: "Show repositories' root", @@ -84,6 +94,7 @@ var commandDocs = map[string]commandDoc{ "get": {"", "[-u] [-p] [--shallow] [--vcs ] [--look] [--silent] [--branch ] [--no-recursive] [--bare] ||/|//"}, "list": {"", "[-p] [-e] []"}, "create": {"", "|/|//"}, + "rm": {"", "|/|//"}, "root": {"", "[-all]"}, } From 3cf46d3a4fa1e9ce355577d0f9a65aab40a138d8 Mon Sep 17 00:00:00 2001 From: Junya Okabe Date: Fri, 26 Jan 2024 17:24:59 +0900 Subject: [PATCH 2/4] feat: add unit test --- cmd_rm_test.go | 168 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 cmd_rm_test.go diff --git a/cmd_rm_test.go b/cmd_rm_test.go new file mode 100644 index 0000000..74d0b94 --- /dev/null +++ b/cmd_rm_test.go @@ -0,0 +1,168 @@ +package main + +import ( + "os" + "os/exec" + "path/filepath" + "runtime" + "sync" + "testing" + + "github.com/x-motemen/ghq/cmdutil" +) + +func TestRmCommand(t *testing.T) { + defer func(orig func(cmd *exec.Cmd) error) { + cmdutil.CommandRunner = orig + }(cmdutil.CommandRunner) + commandRunner := func(cmd *exec.Cmd) error { + return nil + } + defer func(orig string) { _home = orig }(_home) + _home = "" + homeOnce = &sync.Once{} + tmpd := newTempDir(t) + defer func(orig []string) { _localRepositoryRoots = orig }(_localRepositoryRoots) + setEnv(t, envGhqRoot, tmpd) + _localRepositoryRoots = nil + localRepoOnce = &sync.Once{} + + testCases := []struct { + name string + input []string + setup func(t *testing.T) + expectErr bool + cmdRun func(cmd *exec.Cmd) error + skipOnWin bool + }{ + { + name: "simple", + input: []string{"rm", "motemen/ghqq"}, + setup: func(t *testing.T) { + os.MkdirAll(filepath.Join(tmpd, "github.com", "motemen", "ghqq"), 0755) + }, + expectErr: false, + }, + { + name: "empty directory", + input: []string{"rm", "motemen/ghqqq"}, + setup: func(t *testing.T) {}, + expectErr: true, + }, + { + name: "incorrect repository name", + input: []string{"rm", "example.com/goooo/gooo"}, + setup: func(t *testing.T) { + os.MkdirAll(filepath.Join(tmpd, "github.com", "motemen", "ghqq"), 0755) + }, + expectErr: true, + }, + { + name: "permission denied", + input: []string{"rm", "motemen/ghqq"}, + setup: func(t *testing.T) { + f := filepath.Join(tmpd, "github.com", "motemen", "ghqq") + os.MkdirAll(f, 0000) + t.Cleanup(func() { + os.Chmod(f, 0755) + }) + }, + expectErr: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + if tc.skipOnWin && runtime.GOOS == "windows" { + t.SkipNow() + } + + if tc.setup != nil { + tc.setup(t) + } + + cmdutil.CommandRunner = commandRunner + if tc.cmdRun != nil { + cmdutil.CommandRunner = tc.cmdRun + } + }) + } +} + +func TestRmDryRunCommand(t *testing.T) { + defer func(orig func(cmd *exec.Cmd) error) { + cmdutil.CommandRunner = orig + }(cmdutil.CommandRunner) + commandRunner := func(cmd *exec.Cmd) error { + return nil + } + defer func(orig string) { _home = orig }(_home) + _home = "" + homeOnce = &sync.Once{} + tmpd := newTempDir(t) + defer func(orig []string) { _localRepositoryRoots = orig }(_localRepositoryRoots) + setEnv(t, envGhqRoot, tmpd) + _localRepositoryRoots = nil + localRepoOnce = &sync.Once{} + + testCases := []struct { + name string + input []string + setup func(t *testing.T) + expectErr bool + cmdRun func(cmd *exec.Cmd) error + skipOnWin bool + }{ + { + name: "simple", + input: []string{"rm", "--dry-run", "motemen/ghqq"}, + setup: func(t *testing.T) { + os.MkdirAll(filepath.Join(tmpd, "github.com", "motemen", "ghqq"), 0755) + }, + expectErr: false, + }, + { + name: "empty directory", + input: []string{"rm", "--dry-run", "motemen/ghqqq"}, + setup: func(t *testing.T) {}, + expectErr: true, + }, + { + name: "incorrect repository name", + input: []string{"rm", "--dry-run", "example.com/goooo/gooo"}, + setup: func(t *testing.T) { + os.MkdirAll(filepath.Join(tmpd, "github.com", "motemen", "ghqq"), 0755) + }, + expectErr: true, + }, + { + name: "permission denied", + input: []string{"rm", "--dry-run", "motemen/ghqq"}, + setup: func(t *testing.T) { + f := filepath.Join(tmpd, "github.com", "motemen", "ghqq") + os.MkdirAll(f, 0000) + t.Cleanup(func() { + os.Chmod(f, 0755) + }) + }, + expectErr: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + if tc.skipOnWin && runtime.GOOS == "windows" { + t.SkipNow() + } + + if tc.setup != nil { + tc.setup(t) + } + + cmdutil.CommandRunner = commandRunner + if tc.cmdRun != nil { + cmdutil.CommandRunner = tc.cmdRun + } + }) + } +} From e0f540a3beaa620be990130bbc7bc9522c9e27a4 Mon Sep 17 00:00:00 2001 From: Junya Okabe Date: Fri, 26 Jan 2024 17:25:15 +0900 Subject: [PATCH 3/4] make CREDITS --- CREDITS | 338 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 338 insertions(+) diff --git a/CREDITS b/CREDITS index 70ae509..ce756bb 100644 --- a/CREDITS +++ b/CREDITS @@ -59,6 +59,64 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ +github.com/cli/go-gh +https://github.com/cli/go-gh +---------------------------------------------------------------- +MIT License + +Copyright (c) 2021 GitHub Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +================================================================ + +github.com/cli/safeexec +https://github.com/cli/safeexec +---------------------------------------------------------------- +BSD 2-Clause License + +Copyright (c) 2020, GitHub Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +================================================================ + github.com/cpuguy83/go-md2man/v2 https://github.com/cpuguy83/go-md2man/v2 ---------------------------------------------------------------- @@ -86,6 +144,27 @@ SOFTWARE. ================================================================ +github.com/davecgh/go-spew +https://github.com/davecgh/go-spew +---------------------------------------------------------------- +ISC License + +Copyright (c) 2012-2016 Dave Collins + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +================================================================ + github.com/daviddengcn/go-colortext https://github.com/daviddengcn/go-colortext ---------------------------------------------------------------- @@ -312,6 +391,91 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +================================================================ + +github.com/google/go-cmp +https://github.com/google/go-cmp +---------------------------------------------------------------- +Copyright (c) 2017 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +================================================================ + +github.com/kr/pretty +https://github.com/kr/pretty +---------------------------------------------------------------- +The MIT License (MIT) + +Copyright 2012 Keith Rarick + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +================================================================ + +github.com/kr/text +https://github.com/kr/text +---------------------------------------------------------------- +Copyright 2012 Keith Rarick + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + ================================================================ github.com/leodido/go-urn @@ -409,6 +573,39 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ +github.com/pmezard/go-difflib +https://github.com/pmezard/go-difflib +---------------------------------------------------------------- +Copyright (c) 2013, Patrick Mezard +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + The names of its contributors may not be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +================================================================ + github.com/russross/blackfriday/v2 https://github.com/russross/blackfriday/v2 ---------------------------------------------------------------- @@ -470,6 +667,33 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================ +github.com/stretchr/testify +https://github.com/stretchr/testify +---------------------------------------------------------------- +MIT License + +Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +================================================================ + github.com/urfave/cli/v2 https://github.com/urfave/cli/v2 ---------------------------------------------------------------- @@ -497,6 +721,33 @@ SOFTWARE. ================================================================ +github.com/xrash/smetrics +https://github.com/xrash/smetrics +---------------------------------------------------------------- +Copyright (C) 2016 Felipe da Cunha Gonçalves +All Rights Reserved. + +MIT LICENSE + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +================================================================ + golang.org/x/crypto https://golang.org/x/crypto ---------------------------------------------------------------- @@ -662,3 +913,90 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================ +gopkg.in/check.v1 +https://gopkg.in/check.v1 +---------------------------------------------------------------- +Gocheck - A rich testing framework for Go + +Copyright (c) 2010-2013 Gustavo Niemeyer + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +================================================================ + +gopkg.in/yaml.v3 +https://gopkg.in/yaml.v3 +---------------------------------------------------------------- + +This project is covered by two different licenses: MIT and Apache. + +#### MIT License #### + +The following files were ported to Go from C files of libyaml, and thus +are still covered by their original MIT license, with the additional +copyright staring in 2011 when the project was ported over: + + apic.go emitterc.go parserc.go readerc.go scannerc.go + writerc.go yamlh.go yamlprivateh.go + +Copyright (c) 2006-2010 Kirill Simonov +Copyright (c) 2006-2011 Kirill Simonov + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +### Apache License ### + +All the remaining project files are covered by the Apache license: + +Copyright (c) 2011-2019 Canonical Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +================================================================ + From 9c9fc5aa43b5c690a9baae9ce6b866c9746c3c5c Mon Sep 17 00:00:00 2001 From: Junya Okabe Date: Fri, 26 Jan 2024 17:30:17 +0900 Subject: [PATCH 4/4] doc: update README --- README.adoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.adoc b/README.adoc index 4126b93..2dee985 100644 --- a/README.adoc +++ b/README.adoc @@ -19,6 +19,7 @@ You can also list local repositories (+ghq list+). ghq get [-u] [-p] [--shallow] [--vcs ] [--look] [--silent] [--branch] [--no-recursive] [--bare] |//|/| ghq list [-p] [-e] [] ghq create [--vcs ] |//|/| +ghq rm [--dry-run] |//|/| ghq root [--all] == COMMANDS @@ -56,6 +57,9 @@ root:: Prints repositories' root (i.e. `ghq.root`). Without '--all' option, the primary one is shown. +rm:: + Remove local repository. If '--dry-run' option is given, the repository is not actually removed but the path to it is printed. + create:: Creates new repository.