Code Monkey home page Code Monkey logo

getgle-coreutils's People

Stargazers

 avatar

Watchers

 avatar

getgle-coreutils's Issues

cat is not complete.

Hi getgle/get52, when looking at the manual of cat there are a bunch of options that cat provides that your php rewrite of cat does not provide.

       -A, --show-all
              equivalent to -vET
       -b, --number-nonblank
              number nonempty output lines, overrides -n
       -e     equivalent to -vE
       -E, --show-ends
              display $ at end of each line
       -n, --number
              number all output lines
       -s, --squeeze-blank
              suppress repeated empty output lines
       -t     equivalent to -vT
       -T, --show-tabs
              display TAB characters as ^I
       -u     (ignored)
       -v, --show-nonprinting
              use ^ and M- notation, except for LFD and TAB
       --help display this help and exit
       --version
              output version information and exit

I tried to write in cat in python (I don't know how to code in PHP) and made some of these options. A lot of them are useless but the main actually usefule ones I think are being able to see a concatenated version of multiple files and being able to see a line count.
https://codeberg.org/zortazert/Python-Projects/src/branch/main/gnu/pof.py

# POF - Print Out Files 
import sys
import os
args = sys.argv[1:]
special = ["-n", "-b",]

if args == []:
    print("No arguments were given")
    quit()
if "-h" in args:
    print("""Usage:
- python pof.py [FILE]
Print out contents of given file (if they exist)
- python pof.py [FILE] [FILE2] [FILE3]
Print out all given files (if they exist)
- python pof.py -n [FILE]
Print out numbered the lines in the file.
- python pof.py -b [FILE]
Print out numbered only blank lines in the file.
- python pof.py -h
Pring out this help""")
    quit()

num=0
for arg in args:
    if os.path.isfile(arg):
        with open(arg) as f:
            if "-n" in args:
                for line in f.read().splitlines():
                    num = num+1
                    print(num, line)   
            elif "-b" in args:
                for line in f.read().splitlines():
                    if line == "":
                        print(line)
                    else:
                        num = num+1
                        print(num, line)
            else:
                print(f.read())
    elif arg in special:
        pass
    else:
        print(f'Can not find "{arg}"')

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.