Commit graph

1452 commits

Author SHA1 Message Date
Michael Gehring
23e0315262 Remove deprecated lint 2020-11-08 19:56:49 -06:00
Joseph Crail
6095dfee66 Split utility files into separate library.
Everything in src/common has been moved to src/uucore. This is defined
as a Cargo library, instead of directly included. This gives us
flexibility to make the library an external crate in the future.

Fixes #717.
2020-11-08 19:56:42 -06:00
Roy Ivy III
67b07eaaa9 create empty repository for 'uucore' 2015-11-23 00:00:01 -05:00
Heather
fa34096bb8 Merge pull request #712 from jbcrail/add-link-tests
Add tests for link.
2015-11-02 10:40:24 +04:00
Joseph Crail
10a2c5c224 Add tests for link. 2015-11-02 01:13:34 -05:00
Heather
1f7f3ad535 Merge pull request #711 from jbcrail/add-rmdir-tests
Add tests for rmdir.
2015-11-02 01:02:56 +04:00
Joseph Crail
3b5c776675 Add tests for rmdir.
I also adjusted error message to conform to GNU implementation.
2015-11-01 15:31:48 -05:00
Heather
510b024d0f Merge pull request #710 from jbcrail/rm-deprecated
Replace deprecated lines_any() with lines().
2015-10-31 11:38:50 +04:00
Heather
a102d63be5 Merge pull request #709 from jbcrail/rm-parentheses
Remove unnecessary parentheses.
2015-10-31 11:38:42 +04:00
Joseph Crail
c58e1ba3d8 Replace deprecated lines_any() with lines(). 2015-10-31 02:50:46 -04:00
Joseph Crail
4121d1e25d Remove unnecessary parentheses. 2015-10-31 02:32:55 -04:00
Heather
57839e4703 Merge pull request #708 from RGafiyatullin/impl-expr-pre-merge-2
Implement expr.
2015-10-10 11:29:02 +04:00
Roman Gafiyatullin
7b54410557 expr: prefix operators length/1, index/3 and substr/3 2015-10-09 19:26:51 +03:00
Roman Gafiyatullin
092e4d1ed4 Implement expr.
Implemented as follows:

    Usage: expr EXPRESSION
      or:  expr OPTION

          --help     display this help and exit
          --version  output version information and exit

    Print the value of EXPRESSION to standard output.  A blank line below
    separates increasing precedence groups.  EXPRESSION may be:

      ARG1 | ARG2       ARG1 if it is neither null nor 0, otherwise ARG2

      ARG1 & ARG2       ARG1 if neither argument is null or 0, otherwise 0

      ARG1 < ARG2       ARG1 is less than ARG2
      ARG1 <= ARG2      ARG1 is less than or equal to ARG2
      ARG1 = ARG2       ARG1 is equal to ARG2
      ARG1 != ARG2      ARG1 is unequal to ARG2
      ARG1 >= ARG2      ARG1 is greater than or equal to ARG2
      ARG1 > ARG2       ARG1 is greater than ARG2

      ARG1 + ARG2       arithmetic sum of ARG1 and ARG2
      ARG1 - ARG2       arithmetic difference of ARG1 and ARG2

      ARG1 * ARG2       arithmetic product of ARG1 and ARG2
      ARG1 / ARG2       arithmetic quotient of ARG1 divided by ARG2
      ARG1 % ARG2       arithmetic remainder of ARG1 divided by ARG2

      STRING : REGEXP   [NOT IMPLEMENTED] anchored pattern match of REGEXP in STRING

      match STRING REGEXP        [NOT IMPLEMENTED] same as STRING : REGEXP
      substr STRING POS LENGTH   [NOT IMPLEMENTED] substring of STRING, POS counted from 1
      index STRING CHARS         [NOT IMPLEMENTED] index in STRING where any CHARS is found, or 0
      length STRING              [NOT IMPLEMENTED] length of STRING
      + TOKEN                    interpret TOKEN as a string, even if it is a
                                   keyword like 'match' or an operator like '/'

      ( EXPRESSION )             value of EXPRESSION

    Beware that many operators need to be escaped or quoted for shells.
    Comparisons are arithmetic if both ARGs are numbers, else lexicographical.
    Pattern matches return the string matched between \( and \) or null; if
    \( and \) are not used, they return the number of characters matched or 0.

    Exit status is 0 if EXPRESSION is neither null nor 0, 1 if EXPRESSION is null
    or 0, 2 if EXPRESSION is syntactically invalid, and 3 if an error occurred.

    Environment variables:
    	* EXPR_DEBUG_TOKENS=1   dump expression's tokens
    	* EXPR_DEBUG_RPN=1      dump expression represented in reverse polish notation
    	* EXPR_DEBUG_SYA_STEP=1 dump each parser step
    	* EXPR_DEBUG_AST=1      dump expression represented abstract syntax tree
2015-10-09 12:31:25 +03:00
Heather
2a2e449fa3 Merge pull request #707 from aarzee/newlines
Clean whitespace
2015-10-06 20:27:05 +03:00
Carlos Liam
87d14978e9 Clean whitespace
Remove leading newlines and replace lines containing only whitespace
with empty lines
2015-10-06 12:04:46 -04:00
Michael Gehring
587d150ced Merge pull request #705 from aarzee/updatedeps
Update dependencies
2015-10-06 17:56:55 +02:00
Carlos Liam
4655fb5fda Update dependencies 2015-10-06 11:40:46 -04:00
Heather
39f1851791 Merge pull request #704 from ebfe/fix-build
Fix nightly build
2015-10-05 13:17:18 +03:00
Heather
545549f5ab Merge pull request #703 from RGafiyatullin/rgafiyatullin-factor-of-power-of-two
factor: panic running againts power of two. (issue #702)
2015-10-02 21:19:58 +03:00
Roman Gafiyatullin
b4dd12104f factor: panic running againts power of two.
No further calculations required in case 'num' is already 1.
2015-10-02 20:30:35 +03:00
Michael Gehring
d167674ba7 Fix nightly build 2015-09-29 22:37:24 +02:00
Heather
b0479661a6 Merge pull request #695 from ebfe/factor-test
factor: reduce number of random tests
2015-09-28 12:55:32 +04:00
Michael Gehring
998d2dedb4 factor: reduce number of random tests 2015-09-28 10:38:04 +02:00
Heather
e82244d604 Merge pull request #694 from ebfe/travis-nightly
Fix test build
2015-09-28 12:18:09 +04:00
Michael Gehring
9ffa50848d Fix test build 2015-09-28 09:52:27 +02:00
Heather
a5e6f8f485 Merge pull request #691 from steveklabnik/stable
Stable
2015-09-28 08:23:04 +03:00
Steve Klabnik
0c117eb8a8 initial work 2015-09-27 23:55:28 -04:00
Steve Klabnik
ac7e289d29 Fix the build 2015-09-27 23:34:23 -04:00
Michael Gehring
b18a2122ae Merge pull request #689 from dbrgn/whoami_fix
whoami fixes
2015-09-18 12:48:14 +02:00
Danilo Bargen
3e1c6e7e71 Use system error codes 2015-09-18 11:51:59 +02:00
Danilo Bargen
0e7223cfb0 Handle null pointer return value for getpwuid on Linux 2015-09-18 11:12:39 +02:00
Danilo Bargen
a8f9b40674 Return Result<String, String> from getusername 2015-09-18 11:12:39 +02:00
Heather
fe0a49f7a4 Merge pull request #671 from ebfe/cargo-build
Basic Cargo based build
2015-09-17 16:42:43 +03:00
Heather
44d3e95008 Merge pull request #686 from czinck/sort-enhance
Enhanced numeric sort and new human readable sort
2015-08-31 07:58:53 +03:00
Christian Zinck
f31192d46a enhanced numeric sort and new human readable sort 2015-08-30 20:06:33 -04:00
Michael Gehring
5411252d3a touch: add filetime dependency 2015-08-28 21:12:30 +02:00
Michael Gehring
9d8abbcb06 Basic Cargo build
Builds the uutils multicall binary containing all utils (except stdbuf)
by default. To only build a subset
    `cargo --no-default-features --features <utils>`
can be used.

Whats missing is building the standalone binaries and a mechanism to
automatically disable the build of unix only utils on windows.
2015-08-28 21:12:30 +02:00
Michael Gehring
314a254d1f Merge pull request #685 from hexsel/depend-on-nightly-officially
Moved code officially to run on nightly since it's a dependency
2015-08-26 21:06:04 +02:00
Gustavo Hexsel
f8df842dfb Moved code officially to run on nightly since it's a dependency 2015-08-26 12:50:07 -04:00
Heather
239443a253 Merge pull request #683 from samfoo/fix-futures-in-du
Fix build by making du not use futures
2015-08-24 10:10:29 +03:00
Sam Gibson
c06b8218f7 Fix build by making du not use futures
Use channels and push them into a vector instead. Code remains largely the same.
2015-08-24 18:57:09 +12:00
Heather
1b58f5aaec Merge pull request #680 from jbcrail/add-tests-for-sums
Add tests for cksum/sum.
2015-08-14 08:14:09 +03:00
Joseph Crail
26f0ec8379 Fix difference w/ GNU coreutils' sum.
When using the SYSV algorithm and reading from standard input, the GNU
coreutils implementation does not output the filename, in this case "-".
2015-08-14 00:10:15 -04:00
Joseph Crail
04014d314c Add tests for cksum/sum. 2015-08-13 21:08:31 -07:00
Heather
809affff6c Merge pull request #678 from jbcrail/stabilize-4
Remove unstable features from mv/touch.
2015-08-12 08:13:40 +03:00
Heather
f98a704604 Merge pull request #679 from jbcrail/stabilize-5
Remove unstable features from ptx.
2015-08-12 08:12:24 +03:00
Joseph Crail
e9b008cf70 Remove unstable features from ptx.
I cleaned up string references, whitespace, and use of unstable
features. I also added a comment about reverting to connect, making
others aware that the method should be replaced by join after 1.3.
2015-08-12 00:01:10 -04:00
Joseph Crail
cc4cf6049e Add tests for touch. 2015-08-11 21:45:11 -04:00
Joseph Crail
eff8851cf9 Fix bug when setting time w/o year. 2015-08-11 21:45:11 -04:00