Comments (5)
I dug into this a little, but think I should set expectations: CMD isn't doing what the rest of Windows is doing. It's always including leading zeroes to help alignment, even though leading zeroes are part of the locale settings and are generally not used elsewhere. This means CMD is left trying to reconstruct strings based on individual locale primitives (see GetLocaleInfo) rather than just let the system format things (as in GetDateFormat).
I'm heading down the same path, but because it's different and needs to be aware of every locale setting to be accurate, it will likely always be a little bit quirky.
from yori.
I pushed a change to master to use locale aware settings for time and date. As noted above, this isn't ideal: it currently covers five elements:
- Date separator character
- Time separator character
- Date field order
- Two or four character years
- 24 hour or 12 hour time
Looking at the other tools, sdir might want to adopt the first two or three, but since its goal is to be compact I don't think 12 hour time would work well there. Finfo is really leaving the user in control of specifying the format string. I can't think of anything else that deals in times and dates.
from yori.
Just want to know... Can this locale-awareness may break Yori's scripts universality?
We know that cmd.exe locales broke so many opportunities to write really universal scripts which would work on every system and every locale! For example date
and time
commands outputs in user-locale format, so we don't have opportunity to grab seperate year from that output and be sure that our code will work on every system and locale
You could just carefully look at theese links:
https://www.robvanderwoude.com/datetimentparse.php
https://ritchielawrence.github.io/batchfunctionlibrary
https://ss64.com/nt/syntax-getdate.html
I just want to point that the cmd's locale awareness just put all of scipters in situation where this is completely impossible to write script that get such a little thing as get current date in bullet-proof manner... This was discusting to not be able to do so!
AFAIK now Yori support output in English locale formats and this makes it predictable and reliable... Please do not set locale dependency by default... because we have some fantastic languages like Turkish, Chineese and Japanese where things go completely wrong way as in English one!
Or at least make an option for locale-awareness like command line parameter or maybe ini file parameter
from yori.
That's a very valid concern and I had the same concern. Just to note a few things:
- Commands line
date
andfinfo
output data points in a caller-specified format. This was an attempt to make life better for scripts; rather than output text and have a script try to parse it, it allows the output to be in the form the script wants. Those commands are not changing. - Following on from the above, commands like
dir
orsdir
seem like horrible things for scripts to parse, so my focus is on ensuring other tools are available for scripts. - The behavior here is optional and can be disabled with
-g
.
I totally agree with your high order point that, one way or another, there should be output that is easy for scripts to consume.
from yori.
I just released 1.21 which I believe fixes this issue. You can upgrade an existing install with ypm -u
. If you find any additional problems, please either reopen this issue or file a new one describing that problem. Thanks for the report!
from yori.
Related Issues (20)
- Ctrl-C stops working after terminating GUI app once HOT 5
- Provide all installer options as command line arguments HOT 2
- Allow for a custom starting directory HOT 2
- Command line length limit in Yori ? Like 8191 in cmd ? HOT 2
- Implement long path pseudo current directory HOT 4
- Broken alias command for paths with spaces HOT 2
- Feature request: Option in Tee to remove color HOT 2
- yori's lsof breaks react-scripts HOT 3
- Yori installer for the arm64 Windows HOT 4
- current version -- 2.0 is marked as infected with a trojan by Windows Defender HOT 3
- yenv: accept variable from stdin HOT 4
- "cab.exe -s -u" does not overwrite files with read-only and system attributes set HOT 2
- "ycopy.exe -p" raises ERRORLEVEL to 1 if there is nothing to overwrite HOT 1
- Can't run Notepad HOT 2
- YoriInit.ys1 script %__APPDIR__% and %__CD__% environment variables on Windows XP HOT 2
- throw er; // Unhandled 'error' event HOT 2
- fail to install yori-core on amd HOT 2
- ConEmu + Clink + Yori + Python + xonsh = surprise XD HOT 2
- CD Improvement HOT 2
- Scrolling with mouse wheel in Windows Terminal isn't working unless you hold down Shift while scrolling HOT 3
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 yori.