Commit graph

1161 commits

Author SHA1 Message Date
Roy Ivy III
1f5749e304 refactor/polish ~ fix cargo clippy complaints (fatal/same if clause) 2020-01-27 21:33:48 -06:00
Roy Ivy III
1f137c245f refactor/polish ~ fix cargo clippy complaints (fatal/cast_ptr_alignment) 2020-01-27 21:33:47 -06:00
Roy Ivy III
c969becbf8 refactor ~ remove unneeded mem::uninitialized() code
.# [why]

`mem::ununitialized()` is deprecated as of rust v1.39.0.

And this use is likely a premature optimization attempting to avoid
initializing the byte array to 0, which is usually a *very* fast operation.

* ref: <https://github.com/rust-lang/rust/blob/master/RELEASES.md>
* ref: <https://stackoverflow.com/questions/3654905/faster-way-to-zero-memory-than-with-memset>
2020-01-27 21:33:47 -06:00
Roy Ivy III
244bdf3d4f who: fix ~ remove unneeded/incorrect time format size change 2020-01-27 21:33:47 -06:00
Roy Ivy III
9416709c9c stat: fix birth/created time transformation 2020-01-27 21:33:47 -06:00
Roy Ivy III
45a04ce5fc refactor ~ replace deprecated trim_{left,right}... with trim_{start,end}...
- `trim_{start,end}{,_matches}` stabilized in rust v1.30.0
- `trim_{start,end}{,_matches}` deprecated (with compiler warnings) in rust v1.33.0

+ requires MinSRV >= v1.30.0

* ref: https://github.com/rust-lang/rust/blob/master/RELEASES.md
2020-01-27 21:33:47 -06:00
Roy Ivy III
c22cf215ba refactor/polish ~ convert to inclusive range operator syntax (..=)
- convert to newer `..=` syntax, fixing compiler warnings

+ requires MinSRV >= v1.26.0

.# [why]

The inclusive range operator (`..=`) was stabilized in rust v1.26.0.

Warnings requesting conversion from the old `...` operator to `..=` were
introduced in rust v1.37.0.

* ref: <https://github.com/rust-lang/rust/blob/master/RELEASES.md>
2020-01-27 21:33:47 -06:00
Roy Ivy III
55209c6490 cp: use CreateFileW to increase legacy windows compatiblity 2020-01-27 21:33:46 -06:00
Alex Lyon
2dad625dfa
Merge pull request #1402 from GabrielGanne/master
ls: fix --color flag
2020-01-27 15:20:43 -08:00
Sylvestre Ledru
0420d0849f uptime: match the gnu version output 2020-01-03 22:58:11 +01:00
bippityboppity
3511aa987a Add the 'dyn' keyword where necessary
The keyword is needed for trait objects and is intended to improve
readability.
https://doc.rust-lang.org/edition-guide/rust-2018/trait-system/dyn-trait-for-trait-objects.html
2019-10-01 18:34:26 +02:00
Gabriel Ganne
64009b090f ls: implement --color=auto behavior
The automatic behavior is to turn on colors only of connected to a
terminal.
Introduce new external crate isatty to handle this.

Signed-off-by: Gabriel Ganne <gabriel.ganne@gmail.com>
2019-06-23 10:38:39 +02:00
Gabriel Ganne
edaf2d85cb ls: implement --color flag
GNU coreutils ls command implements the --color option as follow:
  --color[=WHEN]
          colorize the output; WHEN can be 'always' (default if omitted),
          'auto', or 'never'

With --color=auto, ls emits color codes only when standard output is connected
to a terminal.

Also, add support for the following aliases:
  - ‘always’, ‘yes’, ‘force’
  - ‘never’, ‘no’, ‘none’
  - ‘auto’, ‘tty’, ‘if-tty’

Signed-off-by: Gabriel Ganne <gabriel.ganne@gmail.com>
2019-06-23 10:35:30 +02:00
dependabot-preview[bot]
427381fd87
build: bump aho-corasick from 0.6.10 to 0.7.3
Bumps [aho-corasick](https://github.com/BurntSushi/aho-corasick) from 0.6.10 to 0.7.3.
- [Release notes](https://github.com/BurntSushi/aho-corasick/releases)
- [Commits](https://github.com/BurntSushi/aho-corasick/compare/0.6.10...0.7.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-21 07:17:27 +00:00
Alex Lyon
33a112d64b
Merge pull request #1400 from uutils/dependabot/cargo/num_cpus-1.10.1
build: bump num_cpus from 1.10.0 to 1.10.1
2019-06-18 09:25:35 -07:00
dependabot-preview[bot]
4b5dbcf995
build: bump num_cpus from 1.10.0 to 1.10.1
Bumps [num_cpus](https://github.com/seanmonstar/num_cpus) from 1.10.0 to 1.10.1.
- [Release notes](https://github.com/seanmonstar/num_cpus/releases)
- [Changelog](https://github.com/seanmonstar/num_cpus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/num_cpus/compare/v1.10.0...v1.10.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-18 13:21:47 +00:00
dependabot-preview[bot]
642a2a4ecb
build: bump memchr from 1.0.2 to 2.2.0
Bumps [memchr](https://github.com/BurntSushi/rust-memchr) from 1.0.2 to 2.2.0.
- [Release notes](https://github.com/BurntSushi/rust-memchr/releases)
- [Commits](https://github.com/BurntSushi/rust-memchr/compare/1.0.2...2.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-17 16:21:06 +00:00
Alex Lyon
8575512895
Merge pull request #1389 from uutils/dependabot/cargo/glob-0.3.0
build: bump glob from 0.2.11 to 0.3.0
2019-06-17 09:18:43 -07:00
dependabot-preview[bot]
50aab8541d
build: bump glob from 0.2.11 to 0.3.0
Bumps [glob](https://github.com/rust-lang/glob) from 0.2.11 to 0.3.0.
- [Release notes](https://github.com/rust-lang/glob/releases)
- [Commits](https://github.com/rust-lang/glob/compare/0.2.11...0.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-15 22:35:35 +00:00
Alex Lyon
bc783edde7
Merge pull request #1388 from uutils/dependabot/cargo/byteorder-1.3.2
build: bump byteorder from 1.3.1 to 1.3.2
2019-06-15 15:34:20 -07:00
Alex Lyon
f1a4d5d4f7
Merge pull request #1393 from uutils/dependabot/cargo/itertools-0.8.0
build: bump itertools from 0.7.11 to 0.8.0
2019-06-15 15:33:56 -07:00
Alex Lyon
16daa41f38
Merge pull request #1392 from uutils/dependabot/cargo/regex-syntax-0.6.7
build: bump regex-syntax from 0.6.6 to 0.6.7
2019-06-15 15:33:45 -07:00
dependabot-preview[bot]
7a24f5e517
build: bump walkdir from 2.2.7 to 2.2.8
Bumps [walkdir](https://github.com/BurntSushi/walkdir) from 2.2.7 to 2.2.8.
- [Release notes](https://github.com/BurntSushi/walkdir/releases)
- [Commits](https://github.com/BurntSushi/walkdir/compare/2.2.7...2.2.8)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-13 12:59:42 +00:00
dependabot-preview[bot]
e7c3d2e381
build: bump itertools from 0.7.11 to 0.8.0
Bumps [itertools](https://github.com/bluss/rust-itertools) from 0.7.11 to 0.8.0.
- [Release notes](https://github.com/bluss/rust-itertools/releases)
- [Commits](https://github.com/bluss/rust-itertools/compare/0.7.11...0.8.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-13 12:59:16 +00:00
dependabot-preview[bot]
a0ca860f93
build: bump regex-syntax from 0.6.6 to 0.6.7
Bumps [regex-syntax](https://github.com/rust-lang/regex) from 0.6.6 to 0.6.7.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/regex-syntax-0.6.6...regex-syntax-0.6.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-13 12:59:04 +00:00
dependabot-preview[bot]
688e08127b
build: bump byteorder from 1.3.1 to 1.3.2
Bumps [byteorder](https://github.com/BurntSushi/byteorder) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/BurntSushi/byteorder/releases)
- [Changelog](https://github.com/BurntSushi/byteorder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/byteorder/compare/1.3.1...1.3.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-06-13 12:57:14 +00:00
Alex Lyon
ab8c2b021a env: fix build on Windows 2019-05-13 12:22:43 -07:00
Alex Lyon
18b19715f9 env: refactor and move away from pre-1.0 Rust conventions 2019-05-13 04:03:10 -07:00
Alex Lyon
b73a664677 Split off uucore into its own repository 2019-05-12 22:42:20 -07:00
Roy Ivy III
bbd0a26012 env: minor fixes and commentary polish 2019-05-09 19:06:32 -05:00
Alex Lyon
8a86c84461 uucore: allow the Linux zero-copy setup on Android 2019-05-01 21:15:01 -07:00
Alex Lyon
2019833fbb uucore: remove an inaccurate comment 2019-05-01 21:15:01 -07:00
Alex Lyon
b46e2289d6 uucore, yes: add zero-copy on supported platforms (only Linux currently) 2019-05-01 21:15:00 -07:00
Alex Lyon
7651d4d3fc Get rid of all warnings on Linux (or at least WSL) 2019-05-01 21:14:40 -07:00
Alex Lyon
db35eab23b Remove git dependencies 2019-05-01 21:14:39 -07:00
Alex Lyon
179de609b5 Replace trim_{left,right} with trim_{start,end} and co. (using Rerast) 2019-05-01 21:14:25 -07:00
Alex Lyon
c7d115b1ad Convert all try!() to ? 2019-05-01 21:14:25 -07:00
Alex Lyon
220e07dc95 Test on FreeBSD using Cirrus CI and link to the Discord in the README 2019-05-01 21:14:25 -07:00
Zachary Dremann
6fe687c84b Replace starts_with and slice with trim_left_matches 2019-04-30 21:02:29 -04:00
Zachary Dremann
34eceae2ef Don't allocate in signal_by_name_or_value 2019-04-29 21:53:14 -04:00
Zachary Dremann
8378c28242 Fix is_signal 2019-04-29 21:35:07 -04:00
Zachary Dremann
1ed8a016c1 Add tests for signals (including failing test for is_signal 2019-04-29 21:32:28 -04:00
Roy Ivy III
31655fc004 env: add support for new '--file' option (includes testing)
.# Discussion

This commit adds support for a '-f'/'--file' option which reads "KEY=VALUE" lines from
a config (or ini) style text file and sets the corresponding environment key. This is
modeled after the same option in the `dotenv` and `godotenv` commands. Notably, this
commit does *not* add automatic loading of ".env" configuration files.

The environment variables set by reading the configuration file are set prior to any
unset (eg, `-u BAR`) or set (eg, `FOO=bar`) actions. Files are loaded in order with
later files overwriting any overlapping environment variables, then, unset actions (in
command line order) are executed, then, finally, set actions (in command line order)
are executed.

[1] [`dotenv`](https://github.com/bkeepers/dotenv)
[2] [`godotenv`](https://github.com/joho/godotenv)
2019-04-29 09:50:22 -05:00
Roy Ivy III
9dc31cc1ce env: enhance support for windows commands (BAT/CMD, builtins)
.# Discussion

`env`/`uutils env` didn't support CMD built-in commands (dir, echo, erase, ...),
BAT/CMD files, nor the usual semantics for command search and execution via
PATHEXT (eg, it wouldn't find/execute `batch.BAT` when given just `batch`).

This patch executes the commands via a CMD subshell and fixes all of those issues.
2019-04-29 09:50:22 -05:00
Reto Habluetzel
905d01623d env: extend help for --null 2019-04-28 12:53:17 +02:00
Reto Habluetzel
2d2042c8fc env: reject program with --null, error stderr 2019-04-28 11:17:44 +02:00
Marcus Millin
7625878cd7 chown: change first file with --reference 2019-04-23 16:30:17 -05:00
Alex Lyon
01966e8aab
Merge pull request #1356 from Arcterus/echo-locked-stdout
echo: write using locked stdout
2019-04-08 15:57:02 -07:00
Alex Lyon
cefbe6c1f2
Merge pull request #1319 from rivy/fix.touch
fix ~ touch: fix and test for windows
2019-04-08 15:16:26 -07:00
Roy Ivy III
256a403caa touch: fix ~ use set_symlink_file_times() + remove unused code 2019-04-07 09:14:46 -05:00