Skip to content

Commit 4765e75

Browse files
committed
Reversed the order of dir/weight
After looking at autojump docs it looks like they do: 42.2 C:\Users\tkellogg Just trying to be as consistent as possible with Autojump as they seem to have nailed something
1 parent 1457f13 commit 4765e75

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

Jump.Location.Specs/FileStoreProviderSpec.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void Dispose()
2626
[Fact]
2727
public void It_can_Revive_a_single_record_of_correctly_formatted_text()
2828
{
29-
var lines = new[] {"FS::C:\\blah\t8.5"};
29+
var lines = new[] {"8.5\tFS::C:\\blah"};
3030
File.WriteAllLines(path, lines);
3131
var provider = new FileStoreProvider(path);
3232

@@ -40,9 +40,9 @@ public void It_can_Revive_multiple_records_of_correctly_formatted_text()
4040
{
4141
var lines = new[]
4242
{
43-
"FS::C:\\blah\t8.5",
44-
"FS::C:\\blah\t8.5",
45-
"FS::C:\\blah\t8.5",
43+
"8.5\tFS::C:\\blah",
44+
"8.5\tFS::C:\\blah",
45+
"8.5\tFS::C:\\blah",
4646
};
4747
File.WriteAllLines(path, lines);
4848
var provider = new FileStoreProvider(path);
@@ -57,7 +57,7 @@ public void It_skips_blank_and_empty_lines()
5757
var lines = new[]
5858
{
5959
"",
60-
"FS::C:\\blah\t8.5",
60+
"8.5\tFS::C:\\blah",
6161
" ",
6262
};
6363
File.WriteAllLines(path, lines);
@@ -70,7 +70,7 @@ public void It_skips_blank_and_empty_lines()
7070
[Fact]
7171
public void It_throws_InvalidOperationException_when_row_doesnt_have_2_columns()
7272
{
73-
var lines = new[] {"FS::C:\\blah 8.5"};
73+
var lines = new[] {"8.5 FS::C:\\blah"};
7474
File.WriteAllLines(path, lines);
7575
var provider = new FileStoreProvider(path);
7676

@@ -102,7 +102,7 @@ public void It_can_save_a_single_record()
102102
provider.Save(db);
103103

104104
var contents = File.ReadAllText(path);
105-
contents.ShouldEqual("FS::C:\\data\t42\r\n");
105+
contents.ShouldEqual("42\tFS::C:\\data\r\n");
106106
}
107107
}
108108
}

Jump.Location/FileStoreProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public FileStoreProvider(string path)
2222
public void Save(IDatabase database)
2323
{
2424
var lines = database.Records.Select(record =>
25-
string.Format("{0}\t{1}", record.FullName, record.Weight));
25+
string.Format("{1}\t{0}", record.FullName, record.Weight));
2626
File.WriteAllLines(path, lines.ToArray());
2727
}
2828

@@ -36,8 +36,8 @@ public IDatabase Revive()
3636
if (columns == null || columns.Length != 2)
3737
throw new InvalidOperationException("Row of file didn't have 2 columns separated by a tab");
3838

39-
var weight = decimal.Parse(columns[1]);
40-
var record = new Record(columns[0], weight);
39+
var weight = decimal.Parse(columns[0]);
40+
var record = new Record(columns[1], weight);
4141
db.Add(record);
4242
}
4343
return db;

Jump.Location/JumpLocationCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public class JumpLocationCommand : PSCmdlet
1313
/*
1414
* 1. Figure out how long they stay in the directory
1515
* 2. Log occurences of filename / weight
16-
* 3. Implement exact substring matches - jump to longest common substring
17-
* 4.
16+
* 3. Tail matches - search matches beginning of last segment of path
17+
* 4. Multiple args - last arg is a tail match, previous args match previous segments
1818
*/
1919

2020
[Parameter(Position = 0)]

0 commit comments

Comments
 (0)