Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

CLI options #1

Open
denysdovhan opened this issue Nov 1, 2015 · 38 comments
Open

CLI options #1

denysdovhan opened this issue Nov 1, 2015 · 38 comments
Labels

Comments

@denysdovhan
Copy link
Owner

Discussion about base options

@iamstarkov and @shuvalov-anton, please leave your suggestions bellow. If you don't mind, let's move the discussion about CLI here.

Transformers [Done #2]

Few -t or --transforms options:

$ textr -t typographic-single-spaces -t typographic-quotes

-t or --transforms as list of transformers:

$ textr -t typographic-single-spaces,typographic-quotes

-t or --transforms throught equal sign:

$ text --transforms=typographic-single-spaces,typographic-quotes

Input [Done #2]

Read from stdin:

$ cat foo.md | textr

Read from file:

$ textr foo.md

Output [Done #2]

Write into stdout:

$ smth | textr > bar.md

Write into file using --out-file or -o flags:

$ textr in.md -o out.md

Locale [Done #2]

Set local using -l and --locale:

textr foo.md -l ru -o bar.md

Watch [Done #3]

--watch and -w:

$ textr input.md -w

Diff

Output diff instead of result:

$ textr --diff

Config

.textrrc with config. This file should be connected automatically. But user should be able to redefine it with -c option (should works like a .vimrc, '.babelrc`, etc).

.textrrc example:

{
    "options": {
        "locale": 'en-us',
        ...
    },
    "watch": true,
    "transformers": [...transformers]
}

Ref to A/textr#1

@denysdovhan denysdovhan changed the title API CLI options Nov 1, 2015
@iamstarkov
Copy link
Collaborator

I love Babel api with 'in', 'out' params and with 'preset' feature

Cheers,
Vladimir Starkov, iamstarkov.com

@denysdovhan
Copy link
Owner Author

@iamstarkov I can add them, in addition to textr [in] [out].

@iamstarkov
Copy link
Collaborator

btw can we just use Babel as framework now when it is general build tool?

Cheers,
Vladimir Starkov, iamstarkov.com

@denysdovhan
Copy link
Owner Author

denysdovhan commented Nov 1, 2015 via email

@A
Copy link
Collaborator

A commented Nov 1, 2015

Here is a --cycle option, that creates new tf instance on every cycle. Do we realy need that option?

I've used the -c option just to benchmark textr. I think, now it's redundant. Feel free to kill it :D

@A
Copy link
Collaborator

A commented Nov 1, 2015

What do you mean when you say "use Babel as framework"?

@iamstarkov Is it really useful for us? Are you suggest to make textr plugin for babel? Or did you meant smth else?

@denysdovhan
Copy link
Owner Author

@shuvalov-anton okay, I'll remove -c.

@iamstarkov
Copy link
Collaborator

I mean Babel is general build system from now on, so maybe we can use Babel
with textr presets

Cheers,
Vladimir Starkov, iamstarkov.com

@denysdovhan
Copy link
Owner Author

Are you suggest to make textr plugin for babel?

I don't think that's a good idea. For example, typography-ellipses will break spread operator. Or are you talking about presets for text files.

@iamstarkov
Copy link
Collaborator

I didn't intend to use it for js projects but if it's possible to use Babel
cli infrastructure then it will be cool

Cheers,
Vladimir Starkov, iamstarkov.com

@denysdovhan
Copy link
Owner Author

@iamstarkov I still don't understand what you want. Can you explain with example?

@iamstarkov
Copy link
Collaborator

yep, but only tomorrow

Cheers,
Vladimir Starkov, iamstarkov.com

@A
Copy link
Collaborator

A commented Nov 1, 2015

I got. But IMHO babel things isn't very useful for small CLI project. I want to take a look on it, but I guess it's about the other.

@iamstarkov
Copy link
Collaborator

I'll also take a look tomorrow and hope It will work out

Cheers,
Vladimir Starkov, iamstarkov.com

@iamstarkov
Copy link
Collaborator

i take a look at babel plugins examples and it seems like the only purpose is javascript files

@iamstarkov
Copy link
Collaborator

so yeah babel is not for us

@iamstarkov
Copy link
Collaborator

but I definitely like its API with --out-file | -o, --out-dir | -d,--watch | -w and piping files $ babel --out-file script-compiled.js < script.js

I think we can learn from them

@iamstarkov
Copy link
Collaborator

$ textr -t typographic-single-spaces,typographic-quotes

is it possible to make it without coma? like this:

$ textr -t typographic-single-spaces typographic-quotes

@denysdovhan
Copy link
Owner Author

I definitely like its API with --out-file | -o, --out-dir | -d, --watch | -w

About -o: I thought use second arg as output file, like this:

$ textr input.md output.md

So, if we use -o, we should remove ability to output into second arg.

About -d: It could be useful for few files. I'll try to implement this (but it conflicts with --diff and -d flags)

About -w: Looks cool. Added to draft.

@denysdovhan
Copy link
Owner Author

is it possible to make it without coma?

It can be cofused with arguments. For example:

$ cat input | textr -t typographic-single-spaces typographic-quotes output.md

Above, output.md could be resolved as transformer.

But, we can use it, like this:

$ cat input | textr -t typographic-single-spaces -t typographic-quotes output.md

@iamstarkov
Copy link
Collaborator

it's just a wish

Cheers,
Vladimir Starkov, iamstarkov.com

@A
Copy link
Collaborator

A commented Nov 3, 2015

is it possible to make it without coma?

It's confusing. -1

But, we can use it, like this:

$ cat input | textr -t typographic-single-spaces -t typographic-quotes output.md

+1

@iamstarkov
Copy link
Collaborator

okay ⚡️

Cheers,
Vladimir Starkov, iamstarkov.com

On 03 Nov 2015, at 9:31 AM, Shuvalov Anton notifications@github.com wrote:

is it possible to make it without coma?
It's confusing. -1

But, we can use it, like this:

$ cat input | textr -t typographic-single-spaces -t typographic-quotes output.md
+1


Reply to this email directly or view it on GitHub.

@denysdovhan
Copy link
Owner Author

What are you thinking about -o|--out-file? Should I implement it, ot better to leave output file as second argument?:

$ textr input.md output.md

or

$ textr input.md -o output.md

P.S: If there isn't second argument, then result will be witten into stdout.

@iamstarkov
Copy link
Collaborator

I would love explicit output param with default stdout

@A
Copy link
Collaborator

A commented Nov 3, 2015

i prefer -o

@denysdovhan
Copy link
Owner Author

okay, I'm gonna implement -o param

@iamstarkov
Copy link
Collaborator

btw, thank you for taking initiative over cli 👏

@denysdovhan
Copy link
Owner Author

I've finished first implementation with tests. Take a look here: https://github.com/denysdovhan/textr-cli/tree/dev

--diff, --watch and -o aren't implemented yet, but I'm in progress.

Also, we've forgot about --locale flag.

@iamstarkov
Copy link
Collaborator

btw, @shuvalov-anton locale was bothering me and i think it shouldnt be 'en' by default and if not defined then textr plugins should not do anything impicitly. what do you think?

@denysdovhan
Copy link
Owner Author

btw, thank you for taking initiative over cli 👏

@iamstarkov that's bcoz i'm gonna use textr, but I need cli. It's profitable to me, at first ;)

@denysdovhan
Copy link
Owner Author

I've finished --locale|-l and --out-file|-o. Now, I'm gonna to release 0.1.0.

@denysdovhan
Copy link
Owner Author

Take a look #2.

@denysdovhan
Copy link
Owner Author

How about adding --config|-c options for loading configuration from json file, like a .eslintrc or .babelrc? Because it's a little bit difficult to write in teminal:

textr some-article.md -t typographic-quotes,typographic-single-spaces,typographic-ellipses,typographic-em-dashes -o output.md -w

@A
Copy link
Collaborator

A commented Nov 15, 2015

LGTM :D

@denysdovhan
Copy link
Owner Author

But what's better loading textrrc, or give opportunity to chose any of json files? I think second case would be better.

@A
Copy link
Collaborator

A commented Nov 15, 2015

I think, good case is specify .textrrc in your dotfiles. This file should be connected automatically. But you should be able to redefine it w/ -c option. Vim works same.

@denysdovhan
Copy link
Owner Author

Yep, I've understood. It will be better.

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

No branches or pull requests

3 participants