Comments (5)
It looks like we need to escape character's ourselves. Instead of worrying about "undoing" the escaping of characters written in a TOML string, we can just use raw TOML strings, which are strings with single quotes ('
) instead of double quotes ("
).
We can then write a program to recognize \)
as escaping a closing bracket, because \
doesn't escape anything in the TOML representation.
This is a breaking change. We can't really do that much about this. We could try to detect the type of quotations that are used, but that would involve parsing the file and might trigger some false positives (this might be worth it though, if we state that these false positives can happen). Otherwise, the documentation should be changed to use single quotes, and it should be directly stated that using double quotes requires double escaping.
from xshe.
However, this finally allows us to implement this feature! When this is completed, we can also easily finish the rest of #38.
from xshe.
To be able to issue warnings, we can read through each line of the file and scan for any line that matches /^[A-Za-z0-9\._]+\s*=\s*\[?\s*"/m
. If we find any, we will display a warning that recommends switching to single quotes.
from xshe.
Also note that the use of double quotes with never be removed, just discouraged for most use cases. This is because after this issue is implemented and merged the new behavior will normally result in having to double escape backslashes while using double quotes.
The warning will either be downgraded it severity or removed in a future version a significant amount of time after the changes in this issue are made. This will probably happen in v1.0.0
.
from xshe.
Update: Warnings will not be issued as that could affect actual use cases.
from xshe.
Related Issues (20)
- Prevent undefined environment variable expansions from making an entire variable declaration blank HOT 1
- Support PowerShell
- Add the ability to set and unset environment variables HOT 2
- Write more specific error messages for failing to read files HOT 1
- Exclude .github from `cargo publish`
- Expand Shell Variables and `~` HOT 1
- Allow installation via Homebrew HOT 1
- Add testing to Xshe
- Expand tildes
- Add man pages (via `clap_mangen`)
- Add shell completion (via `clap_complete`)
- Expand shell variables
- [BUG] Tildes (`~`) are not expanded in all array indexes except the first
- Add Integration Testing HOT 1
- Add Unit Testing
- Crash occurs when failing to read invalid piped input data
- Create detailed documentation and website
- Add `$XSHE_FILE` environment variable to customize the default location of `xshe.toml`
- Improve autocompletion
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xshe.