Giter VIP home page Giter VIP logo

normalize-spaces's People

Contributors

coreen avatar

Watchers

 avatar  avatar

normalize-spaces's Issues

Dropping trailing spaces removes all spaces in file input

Repro Steps

$ ./spaceReplace
please enter the number of spaces a TAB character should equal: 
	3
do you want trailing spaces after TAB conversion to be dropped? [Y/N]: 
	Y
dropping trailing spaces
what type of input will be provided? [F(ile)/S(tdin)]: 
	F
please enter the input file to process: 
	server.py
how should output be formatted? [I(nline)/E(xternal File)]: 
	I

Note: Outputs to tmp.txt when inline option specified

Expected Output

"""
sample Python 2 Flask server with mix of spaces and tabs

Python 3 does not allow for mixed space/tab use
Python 2 highly recommends conversion to only spaces
(Source: https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces)

The normalize-spaces executable can be used for proper conversion for both
"""

from flask import Flask

app = Flask(__name__)

@app.route('/')
def home():
	return 'Started Flask server on port 5000!'

if __name__ == "__main__":
	 app.run(debug=True)


Actual Output

"""
samplePython2Flaskserverwithmixofspacesandtabs

Python3doesnotallowformixedspace/tabuse
Python2highlyrecommendsconversiontoonlyspaces
(Source:https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces)

Thenormalize-spacesexecutablecanbeusedforproperconversionforboth
"""

fromflaskimportFlask

app=Flask(__name__)

@app.route('/')
defhome():
	return'StartedFlaskserveronport5000!'

if__name__=="__main__":
	app.run(debug=True)


Feature Request: Full inline file replacement

Currently inline file replacement creates a tmp.txt file with the processed output. As a consumer, I still need to manually run the following shell commands in order to have the output be truly inline.

rm <inputFilename>
mv tmp.txt <inputFilename>

Ideally this would be done within the program itself.

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.