Skip to content

Commit

Permalink
refactor: cleanup misc
Browse files Browse the repository at this point in the history
  • Loading branch information
rushiiMachine committed Dec 25, 2024
1 parent accfde4 commit fb02df7
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 7 deletions.
56 changes: 56 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
root = true

[*]
charset = utf-8
end_of_line = lf
tab_width = 4
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 100
trim_trailing_whitespace = true
ij_continuation_indent_size = 4
ij_formatter_tags_enabled = true
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false

[*.rs]
ij_rust_keep_line_breaks = true

[{*.markdown,*.md}]
indent_size = 2
ij_markdown_force_one_space_after_blockquote_symbol = true
ij_markdown_force_one_space_after_header_symbol = true
ij_markdown_force_one_space_after_list_bullet = true
ij_markdown_force_one_space_between_words = true
ij_markdown_insert_quote_arrows_on_wrap = true
ij_markdown_keep_indents_on_empty_lines = false
ij_markdown_keep_line_breaks_inside_text_blocks = true
ij_markdown_max_lines_around_block_elements = 1
ij_markdown_max_lines_around_header = 1
ij_markdown_max_lines_between_paragraphs = 1
ij_markdown_min_lines_around_block_elements = 1
ij_markdown_min_lines_around_header = 1
ij_markdown_min_lines_between_paragraphs = 1
ij_markdown_wrap_text_if_long = true
ij_markdown_wrap_text_inside_blockquotes = true

[*.yml]
tab_width = 2
indent_size = 2
ij_yaml_align_values_properties = do_not_align
ij_yaml_autoinsert_sequence_marker = true
ij_yaml_block_mapping_on_new_line = false
ij_yaml_indent_sequence_value = true
ij_yaml_keep_indents_on_empty_lines = false
ij_yaml_keep_line_breaks = true
ij_yaml_sequence_on_new_line = false
ij_yaml_space_before_colon = false
ij_yaml_spaces_within_braces = true
ij_yaml_spaces_within_brackets = true

[*.lock]
ij_formatter_enabled = false
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
9 changes: 2 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::{env, fs, io, panic};
use ini::Ini;
use seahorse::{App, Command, Context, Flag, FlagType};

mod shortcuts;
mod osu_util;
mod icons;
mod osu_util;
mod shortcuts;

fn main() {
let osu_flag = Flag::new("osu", FlagType::String)
Expand Down Expand Up @@ -117,8 +117,6 @@ fn switch(ctx: &Context) {
println!("Switching to {server}!");

let system_username = whoami::username();
println!("Running for user {system_username}");

let osu_cfg = format!("{osu_dir}/osu!.{system_username}.cfg");
let osu_exe = format!("{osu_dir}/osu!.exe");
let osu_db = format!("{osu_dir}/osu!.db");
Expand All @@ -145,9 +143,6 @@ fn switch(ctx: &Context) {
let mut osu_ini = Ini::load_from_file(&osu_cfg)
.expect(&format!("Failed to read osu!.{system_username}.cfg"));

// rust trickery
// .section() returns an immutable reference,
// as long as its in scope I cannot borrow as a mutable reference using .with_section later
let (old_server, current_username, current_password) = {
let cfg = osu_ini.section(None::<String>)
.expect("Corrupted osu user config");
Expand Down

0 comments on commit fb02df7

Please sign in to comment.