Giter VIP home page Giter VIP logo

Comments (11)

asottile avatar asottile commented on May 20, 2024

I believe you're looking for --print-only?

from reorder-python-imports.

alok avatar alok commented on May 20, 2024

My bad. Does this support reading STDIN as well (AFK, so I can't check right now)?

from reorder-python-imports.

asottile avatar asottile commented on May 20, 2024

reorder-python-imports /dev/stdin --print-only should work:

$ echo -e 'import os\nimport pre_commit\nimport sys' | reorder-python-imports /dev/stdin --print-only
==> /dev/stdin <==
import os
import sys

import pre_commit

from reorder-python-imports.

asottile avatar asottile commented on May 20, 2024

(note that the ==> /dev/stdin <== output goes to stderr)

from reorder-python-imports.

asottile avatar asottile commented on May 20, 2024

closing: if --print-only doesn't satisfy your usecase please provide additional context and I'll reopen :)

from reorder-python-imports.

alok avatar alok commented on May 20, 2024

Sorry, forgot about this. It needs to output specifically to STDOUT rather than STDERR since most editor formatter plugins only read STDOUT. Plus, it's not really an error as such, so it shouldn't be redirected there.

from reorder-python-imports.

asottile avatar asottile commented on May 20, 2024

it does, you haven't tried it have you :P

from reorder-python-imports.

alok avatar alok commented on May 20, 2024

You're right, I didn't. I misread the sentence "(note that the ==> /dev/stdin <== output goes to stderr)". I thought you meant all of it was redirected to STDERR rather than just that literal line. My bad.

from reorder-python-imports.

alok avatar alok commented on May 20, 2024

On the other hand, I don't think Windows supports /dev/stdin. I don't use Windows, but I'd expect other people do.

from reorder-python-imports.

asottile avatar asottile commented on May 20, 2024

If someone on windows wants the feature then we'll talk -- as it is it hasn't been an ask so far and if I'm not going to use it and you're not going to use it there's no point in complicating this tool

from reorder-python-imports.

pmiddend avatar pmiddend commented on May 20, 2024

I'm trying to implement emacs support for this fine tool. This would be a little easier if --print-only always printed the result, whether there was a reordering or not. Is that possible?

from reorder-python-imports.

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.