Click here to Skip to main content
15,028,402 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
like if i give...
>>config mode
then it must be stored as
{
"config" : "mode"

}

What I have tried:

I saw an article saying jWrite but didn't got much help...
and also i thought of converting log file to JSON file.
Posted
Updated 24-Jan-21 19:49pm

1 solution

You can't store commands given to the command prompt as anything, unless those commands are either typed into your app, or execute your app - to do anything else would require a keylogger, and we aren't about to start helping with those!

If you are after the command line that executed your code, it's simple - it's passed to the startup method ("main" for a console based app) as the arguments. You can do what you want with that including write it as JSON data where ever you like!

If you are after data typed into your app then that's entirely up to you: how you store it is your decision, but since JOSN is a hierarchical store we can't just give you exact code because we have no idea what the relationship between the data items might be, and that';s essential for organised data (but irrelevant for a log file or "flat text" storage).

Have a think about exactly what you are trying to do and why: your question doesn't read like you are sure, but are just trying to code something by "guess and hope" and that never works well! :laugh:
   
Comments
Member 15055033 25-Jan-21 3:49am
   
See, am using Linux. and i have used a library named as ICLI(interactive command line interface) which lets you build your own prompt and for which i want commands that i write to be stored as JSON file. so, it will easier to parse on client or server side.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900