Coder Social home page Coder Social logo

Comments (3)

thaJeztah avatar thaJeztah commented on August 14, 2024 2

I would suggest;

  • (if possible); check if the repo exists before prompting, and print a error "tag/image foo:bar does not exist"
  • For removing a single tag, perhaps a [yN] is sufficient (I can see having to type the whole name being more useful for removing a whole repository (if it has multiple tags)
  • --force should just do that; remove if exists, and ignore if it was found already (same as rm -f nosuchfile ignores non-existing files/directories)

For the warning printed, make it more clear that it's a destructive operation; something like

WARNING: you are about to permanently delete foo:bar.
This operation cannot be reversed!
Are you sure you want to continue? [yN] 

from hub-tool.

chris-crone avatar chris-crone commented on August 14, 2024

Looks like the same issue exists for repo rm. I'm working out how best to fix this (i.e.: in the client or in the CLI)

from hub-tool.

spkane avatar spkane commented on August 14, 2024

When using -f the command should really exit with exit code 0, if the tag does not exist, so that this can easily be used in automation.

hub-tool tag rm -f user/tool:tag

Maybe with something like this:

diff -ur hub-tool/internal/commands/tag/rm.go hub-tool-envlogin/internal/commands/tag/rm.go
--- hub-tool/internal/commands/tag/rm.go	2022-01-05 13:04:09.000000000 -0800
+++ hub-tool-envlogin/internal/commands/tag/rm.go	2022-01-05 13:04:58.000000000 -0800
@@ -96,7 +96,12 @@
 	}

 	if err := hubClient.RemoveTag(reference.FamiliarName(ref), ref.Tag()); err != nil {
-		return err
+		if strings.Contains(err.Error(), "404 NOT FOUND") {
+			fmt.Fprintln(streams.Out(), "Not Found", image)
+			return nil
+		} else {
+			return err
+		}
 	}
 	fmt.Fprintln(streams.Out(), "Deleted", image)
 	return nil

from hub-tool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.