Git Product home page Git Product logo

Comments (10)

nahoj avatar nahoj commented on July 17, 2024 5

I wonder if we should just drop the optional command, and just do trash put.

Sounds very reasonable. Any existing script that relies on trash <file> is already very brittle, because it breaks on a file named list.

As for interactive use, typing trash put is less convenient, but anyone who uses it often can define an alias.

from trashy.

stelcodes avatar stelcodes commented on July 17, 2024 3

Just some user feedback, I would personally not mind at all if the subcommand was made necessary. I noticed the help/manpage generation is a bit confusing at the moment:

Help:

Usage: trash [OPTIONS] [PATHS]... [COMMAND]

Manpage:

SYNOPSIS
       trashy [-c|--color] [-t|--table] [-h|--help] [-V|--version] [PATHS] [subcommands]

Notice how the subcommands argument is positioned after the PATHS. While technically true for the trash <path> invocation, that's a bit confusing for new users. Making this change might make clap generate a more readable docstring.

from trashy.

jordan-bravo avatar jordan-bravo commented on July 17, 2024 2

+1 to this problem.

I'm getting the error when trying to use tab completion, regardless of whether I use the command trash or trash put.

Steps to reproduce

Type trash then press Tab.
or
Type trash put then press Tab.

Expected result

Tab completion should show the files and folders in current directory.

Actual result

The following error is displayed:

_arguments:comparguments:327: doubled rest argument definition: *::: :->trashy

Additional info

OS: NixOS
Shell: Zsh
Terminal: Kitty

from trashy.

almazgaliev avatar almazgaliev commented on July 17, 2024

@jmcantrell this is clap bug , checkout here

from trashy.

zUnixorn avatar zUnixorn commented on July 17, 2024

Clap has now fixed the underlying issue and also just made a new release. Bumping the version of clap to v4.1.8 could fix this issue then.

from trashy.

oberblastmeister avatar oberblastmeister commented on July 17, 2024

@jmcantrell @almazgaliev @zUnixorn I updated clap in #78. Does this fix the issue?

from trashy.

jmcantrell avatar jmcantrell commented on July 17, 2024

@oberblastmeister I only tested zsh, but I replaced /usr/share/zsh/site-functions/_trash with the completion script generated by trashy on master and I still get the same error. Does it work for you?

from trashy.

jmcantrell avatar jmcantrell commented on July 17, 2024

I've been digging through this project's code and clap's for a bit and I'm thinking that this might not be a solvable problem on clap's end. The way trashy is using the parser now (as I understand it) is that it's flattening the main commands args into the parser along with the put command's args, both of those sets of args expect varying number of trailing arguments. The main command is looking for 0 or 1 command names whereas the put command is looking for 0 or more paths. Zsh, and I'm pretty sure the other supported shells, do not support this, which means that there will not be a way to generate a correct completion script.

I'm looking at the git example in clap's docs (https://docs.rs/clap/latest/clap/_derive/_cookbook/git_derive/index.html) to see how they handle this case (git stash, where push is the default command).

from trashy.

oberblastmeister avatar oberblastmeister commented on July 17, 2024

I wonder if we should just drop the optional command, and just do trash put.

from trashy.

jmcantrell avatar jmcantrell commented on July 17, 2024

Personally, that's the interface I want, and if this were a brand new project it would be what I would push for. The only reason I didn't suggest it is because it's a breaking change, and it's one of the features mentioned in the readme.

from trashy.

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.