Skip to content
This repository has been archived by the owner on Dec 27, 2017. It is now read-only.

Propose a default cli format #4

Closed
fzaninotto opened this issue Aug 25, 2014 · 8 comments
Closed

Propose a default cli format #4

fzaninotto opened this issue Aug 25, 2014 · 8 comments
Assignees

Comments

@fzaninotto
Copy link

A cli tool usually outputs simple data to STDOUT, so that other tools can use it via pipe.

I can't find a simple way to output a list of 10 names via faker-cli. I tried:

$ faker.phar name -c10 -fprintf -p%s
"Esther Miller"
"Van Greenfelder II"
"Assunta Nikolaus III"
"Aiyana Bednar"
"Ruthie Conn"
"Dereck Farrell MD"
"Kristopher Rodriguez"
"Mrs. Emil VonRueden"
"Baylee Kuvalis"
"Terrill Hayes"

But the output contains double quotes, that I don't need.

So I'd need a "cli" formatted, outputting raw data. I tend to think this should be the default formatter.

Also, I usually need more than 1 record. Why don't you make the default value of the count parameter 10 instead of 1?

@tristanlins
Copy link
Contributor

Meh, your right, I changed the default value for the enclosure parameter to " to fix the CSV issue. I have reverted the changes and fixed it another way. :-)

@fzaninotto
Copy link
Author

Great! And how about changing the defaults (format to 'vprintf', pattern to '%s', count to 10)?

@tristanlins
Copy link
Contributor

Yes that is a good idea for a CLI tool :-)

@tristanlins tristanlins reopened this Sep 16, 2014
@tristanlins tristanlins self-assigned this Sep 16, 2014
@fzaninotto
Copy link
Author

great news that you're working on that. And by the way, if you can take the latest HEAD to package the next phar version, I'd be delighted ; I miss the ability to generate passwords via the command line.

@tristanlins
Copy link
Contributor

I have released version 1.1, which use printf as default format (see the updated readme).

I miss the ability to generate passwords via the command line

If faker support password generation, faker-cli will also support it ;-)
Personally I use pwgen for password generation on the command line ;-)

@fzaninotto
Copy link
Author

I downloaded 1.1, and it still generates in JSON format.

> faker.phar name -c 10
[
    "Wilson Boehm MD",
    "Jermaine Breitenberg",
    "Alana Cummings",
    "Dr. Cassandra Turner",
    "Miss Catherine Steuber",
    "Mr. Hans Gleichner DVM",
    "Ms. Leta Hackett",
    "Josh Runolfsson",
    "Susan Kuhlman",
    "Tremayne Gaylord"
]

@tristanlins
Copy link
Contributor

It works for me:

$ wget https://github.com/bit3/faker-cli/releases/download/1.1/faker.phar
...

$ php faker.phar --version
Faker Command Line Tool version 1.1

$ php faker.phar name -c 10
Mr. Izaiah Farrell I
Lennie Bergnaum
Adriana Pfannerstill II
Chauncey Bartell
Bernhard O'Conner PhD
Mr. Coty Breitenberg DDS
Benny Hoeger
Oleta Stracke
Dannie Greenholt
Doug Cummerata

Please try faker.phar --version to verify the version.

@fzaninotto
Copy link
Author

My bad, you're right, I had an old global install overriding the one I just downloaded. It works all right, thanks.

Did you consider making faker.phar called with no argument output the content of faker.phar --help?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants