| 1 | extern crate sanitize_filenamerust-analyzer cargo sanitize-filename 0.6.0 sanitize_filename/; |
| 2 | |
| 3 | fn mainrust-analyzer cargo sanitize-filename 0.6.0 main().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> { |
| 4 | |
| 5 | let mut input = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 6 | let mut set_replacement = false; |
| 7 | let mut replacement = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 8 | let mut truncate = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 9 | let mut windows = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 10 | |
| 11 | for arg in ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::argsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/args().().skiprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#skip().(1) { |
| 12 | if set_replacement { |
| 13 | replacement = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(arg); |
| 14 | set_replacement = false; |
| 15 | } else if arg rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."-r" || arg rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."--replace" { |
| 16 | set_replacement = true; |
| 17 | } else if arg rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."--truncate" { |
| 18 | truncate = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true); |
| 19 | } else if arg rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."--no-truncate" { |
| 20 | truncate = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false); |
| 21 | } else if arg rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."--windows" { |
| 22 | windows = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true); |
| 23 | } else if arg rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."--no-windows" { |
| 24 | windows = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false); |
| 25 | } else if arg rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq()."-" { |
| 26 | input = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 27 | } else { |
| 28 | input = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(arg); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | let input = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(input) = input { |
| 33 | input |
| 34 | } else { |
| 35 | let mut buffer = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 36 | ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#::read_to_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/impl#[Stdin][Read]read_to_string().(&mut ::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::stdinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/stdin().(), &mut buffer)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 37 | buffer |
| 38 | }; |
| 39 | |
| 40 | let mut options = sanitize_filenamerust-analyzer cargo sanitize-filename 0.6.0 crate/::Optionsrust-analyzer cargo sanitize-filename 0.6.0 Options#::defaultrust-analyzer cargo sanitize-filename 0.6.0 impl#[`Options<'a>`][Default]default().(); |
| 41 | |
| 42 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref replacement) = replacement { |
| 43 | options.replacementrust-analyzer cargo sanitize-filename 0.6.0 Options#replacement. = replacement; |
| 44 | } |
| 45 | |
| 46 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(windows) = windows { |
| 47 | options.windowsrust-analyzer cargo sanitize-filename 0.6.0 Options#windows. = windows; |
| 48 | } |
| 49 | |
| 50 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(truncate) = truncate { |
| 51 | options.truncaterust-analyzer cargo sanitize-filename 0.6.0 Options#truncate. = truncate; |
| 52 | } |
| 53 | |
| 54 | let output = sanitize_filenamerust-analyzer cargo sanitize-filename 0.6.0 crate/::sanitize_with_optionsrust-analyzer cargo sanitize-filename 0.6.0 sanitize_with_options().(input, options); |
| 55 | |
| 56 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{}", &output); |
| 57 | |
| 58 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 59 | |
| 60 | } |