vlang / coreutils Goto Github PK
View Code? Open in Web Editor NEWThis repository contains programs equivalent to GNU coreutils, written in the V language.
License: MIT License
This repository contains programs equivalent to GNU coreutils, written in the V language.
License: MIT License
version := 'whoami (V coreutils) 0.0.1'
Is the whoami
v0.0.1? Or Vcoreutils?
I'd like to suggest 1 of the following; hopefully the first:
// whoami version
version := 'whoami 0.0.1 (V coreutils)'
// V coreutils
version := 'whoami (V coreutils 0.0.1)'
Thanks for starting on this project!
Since we want these tools to be as compatible as possible with their GNU counterparts, issue like this need to be opened. The reason is that many other tools try to parse the output of the coreutils programs, and will fail if the differences are large.
I just attempted cat README.md |bin/wc -l
and saw extra whitespace at the beginning of the line, and extra whitespace and a dash (-
) after. Here is the output from running first the V coreutils version, the the GNU version:
jamie@5950x coreutils]$ cat README.md |bin/wc -l
144 -
[jamie@5950x coreutils]$ cat README.md |wc -l
144
[jamie@5950x coreutils]$
Please make the outputs match, and test the output of the other options against GNU version of wc
.
I've noticed there is no standard to the program structures. V is easy to understand, but would be better if the codebase looked the same though out. EG strange that even the version code is different between these 2 commands:
https://github.com/vlang/coreutils/blob/main/false/false.v#L7
https://github.com/vlang/coreutils/blob/main/whoami/whoami.v#L15
More standardized code would be easier to review, maintain, & automate (both in creation & testing).
PR #47
version: V 0.2.4 90e04d0
compiling nl...
failed cmd: v -Wimpure-v -prod -o /home/shenteng-tu/projects/CONTRIBUTING/v-coreutils/bin/nl ./nl
failed code: 1
V panic: ./nl/nl.v:152:10: error: cannot assign a reference to a value (this will be an error soon) left=[]string false right=[]string true ptr=true
150 | // if there are no files, read from stdin
151 | if args_fn.len > 0 {
152 | fnames = &args_fn
| ^
153 | }
154 |
v hash: 90e04d0
On Mac Sonoma 14.4.1 (M2 chip)
make
compiling md5sum...
compiling cat...
compiling shuf...
compiling expand...
compiling tty...
compiling basename...
compiling truncate...
compiling echo...
compiling pwd...
compiling test...
compiling whoami...
compiling touch...
compiling unlink...
compiling sleep...
compiling logname...
compiling printenv...
compiling seq...
compiling uname...
compiling sha224sum...
compiling base64...
compiling readlink...
compiling tac...
compiling wc...
compiling nproc...
compiling expr...
compiling cksum...
compiling printf...
compiling groups...
compiling factor...
compiling head...
compiling uniq...
compiling stat...
failed cmd: /Users/mike/Documents/github/v/v -Wimpure-v -o /Users/mike/Documents/github/coreutils/bin/stat ./stat
failed code: 1
V panic: builder error: Header file <bits/statx.h>, needed for module `main` was not found. Please install the corresponding development headers.
v hash: 35f6523
0 build 0x0000000100c671e4 os__execute_or_panic + 320
1 build 0x0000000100c6c750 main__main + 3036
2 build 0x0000000100c6cd40 main + 84
3 dyld 0x00000001946e20e0 start + 2360
make: *** [all] Error 1```
I would like to have a go at this.
I will be working on an implementation for mkdir
in V.
the current implementation of factor is laughably bad; consider using Floyd's cycle-finding algorithm with Brent's algorithms to somehow faciliate optimised Pollard's rho algorithm. It seems to be what coreutils
do (+ trial division i guess), except I can't be bothered to check what kind of cycle finding algorithm do they use, since the code is, as usual for GNU, obfuscated.
Claiming dir
The commands like uptime
, users
, who
in GNU coreutils inculde "readutmp.h"
which can not be found in V, but we can make a V implementation based on <utmp.h>
& <utmpx.h>
.
The work is in proccess with utime
implementation.
I will take up the cp
, mv
, rm
programs.
Claiming ls
Not sure tar is part of core utilities, but is there a plan to add? Tar also likely has to be a part of standard library, but I did not find it there... Any known implementation of tar in V?
It's seem kinda unorganized when I see there are all these claimed module
issues, maybe instead we should create a project where every module is created an can be assigned to a user. Then we have there something like an automated kanban with 3-4 states, like TODO, In-Progress, In-Review and Done. I think this would give everyone more overview about what's already done, what is in progress and what is done. Feel free to discuss about it 😄
Claiming ls
I execute the command v run build.vsh
in Git Bash on Windows 10. It output the following message. Does anyone know how to fix this error?
User@DESKTOP MINGW64 /d/Program Files/v_windows/v/blog/mk/coreutils (main)
compiling arch...
failed cmd: v -Wimpure-v -o D:\Program Files\v_windows\v\blog\mk\coreutils/bin/arch ./arch
failed code: 1
V panic: v Files\v_windows\v\blog\mk\coreutils/bin/arch: unknown command
Run v help for usage.
v hash: d0a11f5
C:/Users/User/AppData/Local/Temp/v_0/build.4116815423438212709.tmp.c:7239: at _v_panic: Backtrace
C:/Users/User/AppData/Local/Temp/v_0/build.4116815423438212709.tmp.c:15208: by os__execute_or_panic
C:/Users/User/AppData/Local/Temp/v_0/build.4116815423438212709.tmp.c:16298: by main__main
C:/Users/User/AppData/Local/Temp/v_0/build.4116815423438212709.tmp.c:16681: by wmain
0046e408 : by ???
0046e56b : by ???
7ff8a71f7034 : by ???
I would like to have a go at it!
(Issue #11 for reference)
title, I plan on writing seq
It makes sense, since this project is essentially replacing the C source with V, the name should also signify that. That way you'll also not get accused of copying the name. So, as a suggestion, I recommend replacing the letter C with V in the project's name too.
Claiming rmdir
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.